|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.FudgeMsgBase
org.fudgemsg.FudgeMsg
public class FudgeMsg
A mutable message in the Fudge system.
The message consists of a list of Fudge fields
.
This class holds the entire message in memory.
Applications are recommended to store and manipulate a FudgeFieldContainer
instance or a MutableFudgeFieldContainer
rather than this class
for future flexibility.
This class is mutable and not thread-safe.
Constructor Summary | |
---|---|
protected |
FudgeMsg(FudgeContext fudgeContext)
Constructor taking a Fudge context. |
protected |
FudgeMsg(FudgeFieldContainer fields,
FudgeContext fudgeContext)
Constructor taking a set of fields and a Fudge context. |
Method Summary | |
---|---|
void |
add(FudgeField field)
Adds a field to this container. |
void |
add(Integer ordinal,
Object value)
Adds a field to this container with an ordinal, no name, and type determined by the context's type dictionary. |
void |
add(String name,
Integer ordinal,
FudgeFieldType<?> type,
Object value)
Adds a field to this container with the given name, ordinal, and type. |
void |
add(String name,
Integer ordinal,
Object value)
Adds a field to this container with the given name, ordinal and type determined by the context's type dictionary. |
void |
add(String name,
Object value)
Adds a field to this container with a name, no ordinal, and type determined by the context's type dictionary. |
void |
clear()
Removes all fields from the message. |
protected FudgeFieldType<?> |
determineTypeFromValue(Object value)
Resolves an arbitrary Java object to an underlying Fudge type (if possible). |
boolean |
equals(Object obj)
Checks if this message equals another. |
Iterator<FudgeField> |
iterator()
Gets an iterator over the list of fields in this container. |
void |
remove(Short ordinal)
Removes all fields with the given ordinal. |
void |
remove(String name)
Removes all fields with the given name. |
void |
remove(String name,
Short ordinal)
Removes all fields matching both the name and ordinal supplied. |
void |
setNamesFromTaxonomy(FudgeTaxonomy taxonomy)
Resolves any field ordinals to field names from the given taxonomy. |
Methods inherited from class org.fudgemsg.FudgeMsgBase |
---|
fieldNameEquals, fieldOrdinalEquals, getAllByName, getAllByOrdinal, getAllFieldNames, getAllFields, getBoolean, getBoolean, getByIndex, getByName, getByOrdinal, getByte, getByte, getDouble, getDouble, getFields, getFieldValue, getFirstTypedValue, getFirstTypedValue, getFloat, getFloat, getFudgeContext, getInt, getInt, getLong, getLong, getMessage, getMessage, getNumFields, getShort, getShort, getString, getString, getValue, getValue, getValue, getValue, hasField, hasField, hashCode, isEmpty, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.fudgemsg.FudgeFieldContainer |
---|
getAllByName, getAllByOrdinal, getAllFieldNames, getAllFields, getBoolean, getBoolean, getByIndex, getByName, getByOrdinal, getByte, getByte, getDouble, getDouble, getFieldValue, getFloat, getFloat, getInt, getInt, getLong, getLong, getMessage, getMessage, getNumFields, getShort, getShort, getString, getString, getValue, getValue, getValue, getValue, hasField, hasField, isEmpty |
Constructor Detail |
---|
protected FudgeMsg(FudgeContext fudgeContext)
fudgeContext
- the FudgeContext
to use for type resolution and other servicesprotected FudgeMsg(FudgeFieldContainer fields, FudgeContext fudgeContext)
The fields from the container are copied into this message, creating a new field for each supplied field.
fields
- the initial set of fields, not nullfudgeContext
- the context to use for type resolution and other services, not nullMethod Detail |
---|
public void add(FudgeField field)
add
in interface MutableFudgeFieldContainer
field
- the field to add, not nullpublic void add(String name, Object value)
add
in interface MutableFudgeFieldContainer
name
- the name of the field, null for nonevalue
- the field value, not nullpublic void add(Integer ordinal, Object value)
add
in interface MutableFudgeFieldContainer
ordinal
- the ordinal for the field, null for nonevalue
- the field value, not nullpublic void add(String name, Integer ordinal, Object value)
add
in interface MutableFudgeFieldContainer
name
- the name of the field, null for noneordinal
- the ordinal index for the field, null for nonevalue
- the field value, not nullpublic void add(String name, Integer ordinal, FudgeFieldType<?> type, Object value)
add
in interface MutableFudgeFieldContainer
name
- the name of the field, null for noneordinal
- the ordinal for the field, null for nonetype
- the field type, not nullvalue
- the field value, not nullprotected FudgeFieldType<?> determineTypeFromValue(Object value)
value
- the object to resolve, null returns the indicator type
public void setNamesFromTaxonomy(FudgeTaxonomy taxonomy)
setNamesFromTaxonomy
in class FudgeMsgBase
taxonomy
- the taxonomy to use, null ignoredpublic Iterator<FudgeField> iterator()
A container is ordered and the returned iterator reflects that order.
iterator
in interface Iterable<FudgeField>
iterator
in interface FudgeFieldContainer
iterator
in class FudgeMsgBase
public void remove(Short ordinal)
remove
in interface MutableFudgeFieldContainer
ordinal
- ordinal index of fields, null matches fields without an ordinalpublic void remove(String name)
remove
in interface MutableFudgeFieldContainer
name
- name of the fields, null matches fields without a namepublic void remove(String name, Short ordinal)
remove
in interface MutableFudgeFieldContainer
name
- the name of the fields to removeordinal
- the ordinal of the fields to removepublic void clear()
clear
in interface MutableFudgeFieldContainer
public boolean equals(Object obj)
The check is performed on the entire list of fields in the message.
equals
in class FudgeMsgBase
obj
- the object to compare to, null returns false
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |