public final class RT_FieldMap extends java.lang.Object implements java.lang.Iterable<RT_FieldMap.FieldInfo>
Field identifiers, or FIDs, are unique identifiers for fields contained in
RT_Message
instances. This class assists in translating FIDs into
readable names and vice versa. This helps in debugging and handling
application configuration. If names are only required at compile time, the
FIDS
class should be used instead.
This class uses translation information stored in an XML file (usually located in "etc/rt_fields.xml" in the base installation path of the DataFeed toolkit). In addition to FID translation, this class also provides data type information for each field.
Modifier and Type | Class and Description |
---|---|
static class |
RT_FieldMap.FieldInfo
An
RT_FieldMap entry which contains information about a
real-time message field. |
static class |
RT_FieldMap.FieldType
A data type for field identifiers.
|
Constructor and Description |
---|
RT_FieldMap(java.lang.String filename)
Constructs an
RT_FieldMap by parsing the given translation
XML file. |
Modifier and Type | Method and Description |
---|---|
RT_FieldMap.FieldInfo |
getFieldInfo(int fid)
Returns the field information associated with the given field
identifier.
|
RT_FieldMap.FieldInfo |
getFieldInfo(java.lang.String name)
Returns the field information associated with the given field name.
|
java.util.Iterator<RT_FieldMap.FieldInfo> |
iterator()
Returns an iterator over the entries in this field map.
|
RT_FieldMap.FieldInfo[] |
toArray()
Returns an array containing all of the
FieldInfo instances
in this field map. |
java.lang.String |
toString()
Returns a brief description of this field map.
|
public RT_FieldMap(java.lang.String filename) throws org.xml.sax.SAXException, java.io.IOException
RT_FieldMap
by parsing the given translation
XML file. A translation file is supplied in the DataFeed toolkit,
located in "etc/rt_fields.xml" in the base installation pathfilename
- the XML document containing the field map datajava.lang.NullPointerException
- if filename
is nullorg.xml.sax.SAXException
- if a parsing error is encounteredjava.io.IOException
- if an error occurs while opening the filepublic RT_FieldMap.FieldInfo getFieldInfo(int fid)
FieldInfo.NOT_FOUND
is returned.fid
- a field identifierFieldInfo
containing information about the given
field identifierpublic RT_FieldMap.FieldInfo getFieldInfo(java.lang.String name)
FieldInfo.NOT_FOUND
is returned.name
- a field nameFieldInfo
containing information about the given
field namepublic java.util.Iterator<RT_FieldMap.FieldInfo> iterator()
FieldInfo
instance.
This is an unmodifiable iterator and attempts to modify it will throw
an UnsupportedOperationException
.
iterator
in interface java.lang.Iterable<RT_FieldMap.FieldInfo>
Iterator
over the
FieldInfo
instances in this field mappublic RT_FieldMap.FieldInfo[] toArray()
FieldInfo
instances
in this field map.
The returned array will be "safe" in that no references to it are maintained by this field map. The caller is thus free to modify the returned array.
FieldInfo
instances
in this field mappublic java.lang.String toString()
toString
in class java.lang.Object