|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FudgeTaxonomy
A Fudge taxonomy providing the connection between a name and an ordinal.
Each field in a Fudge message may contain a name and an ordinal. All four combinations of name and ordinal are possible - from both present to both absent.
The purpose of the ordinal is primarily to be a shorthand 2-byte key to a full name. The connection between the ordinal and the name is given by the taxonomy.
The key point is that the taxonomy is dumb. If a taxonomy is used in a complex message, then field names would be replaced by ordinals. Consider a large message that contains the field name 'foo'. The name 'foo' occurs multiple times in the overall message within two types of sub-message - 'bar and 'baz'. The meaning of 'foo' is thus different depending on whether it is in 'bar' or 'baz'. When a taxonomy is used, the name 'foo' is replaced by the same ordinal in both types of message. Similarly, the ordinal is replaced by the name 'foo' when read back in. This means that the ordinal has no unique meaning. 'foo' in 'bar' and 'foo' in 'baz' are the same.
A taxonomy may be obtained from a TaxonomyResolver
.
This interface should be implemented with care to ensure Fudge operates correctly. Implementations must be thread-safe and should probably be immutable.
Method Summary | |
---|---|
String |
getFieldName(short ordinal)
Looks up the field name for the given ordinal. |
Short |
getFieldOrdinal(String name)
Looks up the field ordinal for the given name. |
Method Detail |
---|
String getFieldName(short ordinal)
Not all ordinals will necessarily be mapped to a name.
This must be implemented to be bidirectional with getFieldOrdinal(String)
.
ordinal
- the ordinal to lookup
Short getFieldOrdinal(String name)
Not all names will necessarily be mapped to an ordinal.
This must be implemented to be bidirectional with getFieldName(short)
.
name
- the name to lookup, null returns null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |