org.fudgemsg.taxon
Interface FudgeTaxonomy

All Known Implementing Classes:
MapFudgeTaxonomy, PropertyFileTaxonomy

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

getFieldName

String getFieldName(short ordinal)
Looks up the field name for the given ordinal.

Not all ordinals will necessarily be mapped to a name. This must be implemented to be bidirectional with getFieldOrdinal(String).

Parameters:
ordinal - the ordinal to lookup
Returns:
the field name, null if the ordinal is not mapped to a name

getFieldOrdinal

Short getFieldOrdinal(String name)
Looks up the field ordinal for the given name.

Not all names will necessarily be mapped to an ordinal. This must be implemented to be bidirectional with getFieldName(short).

Parameters:
name - the name to lookup, null returns null
Returns:
the field ordinal, null if the name is not mapped to a ordinal


Copyright 2009-Present by OpenGamma Inc. and individual contributors
Released under the Apache License, Version 2.0