|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.taxon.MapFudgeTaxonomy
public class MapFudgeTaxonomy
An immutable taxonomy implementation based on a bidirectional map.
This is the standard implementation.
Field Summary | |
---|---|
static FudgeTaxonomy |
EMPTY
An empty taxonomy. |
Constructor Summary | |
---|---|
MapFudgeTaxonomy(int[] ordinals,
String[] names)
Creates a new taxonomy initialized by a list of ordinals and corresponding names. |
|
MapFudgeTaxonomy(Map<Integer,String> ordinalToNameMap)
Creates a new taxonomy initialized by the supplied map. |
Method Summary | |
---|---|
static FudgeTaxonomy |
fromFudgeMsg(FudgeFieldContainer msg)
Decodes a taxonomy from a Fudge message as per the specification. |
String |
getFieldName(short ordinal)
Looks up the field name for the given ordinal. |
Short |
getFieldOrdinal(String fieldName)
Looks up the field ordinal for the given name. |
MutableFudgeFieldContainer |
toFudgeMsg(FudgeMessageFactory context)
Encodes the taxonomy as a Fudge message as per the specification. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final FudgeTaxonomy EMPTY
Constructor Detail |
---|
public MapFudgeTaxonomy(Map<Integer,String> ordinalToNameMap)
ordinalToNameMap
- the map of ordinal to field names, not null, no nullspublic MapFudgeTaxonomy(int[] ordinals, String[] names)
ordinals
- the array of ordinal values, not nullnames
- the array of field names, not null, no nullsMethod Detail |
---|
public String getFieldName(short ordinal)
FudgeTaxonomy
Not all ordinals will necessarily be mapped to a name.
This must be implemented to be bidirectional with FudgeTaxonomy.getFieldOrdinal(String)
.
getFieldName
in interface FudgeTaxonomy
ordinal
- the ordinal to lookup
public Short getFieldOrdinal(String fieldName)
FudgeTaxonomy
Not all names will necessarily be mapped to an ordinal.
This must be implemented to be bidirectional with FudgeTaxonomy.getFieldName(short)
.
getFieldOrdinal
in interface FudgeTaxonomy
fieldName
- the name to lookup, null returns null
public MutableFudgeFieldContainer toFudgeMsg(FudgeMessageFactory context)
An encoded taxonomy can be decoded back to a taxonomy object by the MapFudgeTaxonomy.fromFudgeMsg method on this class or equivalent function in any other language implementation.
context
- the message context, not null
public static FudgeTaxonomy fromFudgeMsg(FudgeFieldContainer msg)
that is backed by a MapFudgeTaxonomy object.
msg
- the message to decode, not null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |