|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.FudgeMsgField
public class FudgeMsgField
A single immutable field in the Fudge system.
This is the standard immutable implementation of FudgeField
.
This class is immutable and thread-safe but is not final.
Constructor Summary | |
---|---|
FudgeMsgField(FudgeField field)
Constructs a field as a copy of another. |
|
FudgeMsgField(FudgeFieldType<?> type,
Object value,
String name,
Short ordinal)
Constructs a field from the type, value, name and ordinal. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Compares this field to another field. |
String |
getName()
Gets the optional field name. |
Short |
getOrdinal()
Gets the optional field ordinal. |
FudgeFieldType<?> |
getType()
Gets the Fudge type of the value. |
Object |
getValue()
Gets the field value. |
static FudgeMsgField |
of(FudgeField field)
Obtains an immutable version of the specified field. |
static FudgeMsgField |
of(FudgeFieldType<?> type,
Object value)
Obtains a field from the type, value, name and ordinal. |
static FudgeMsgField |
of(FudgeFieldType<?> type,
Object value,
Short ordinal)
Obtains a field from the type, value, name and ordinal. |
static FudgeMsgField |
of(FudgeFieldType<?> type,
Object value,
String name)
Obtains a field from the type, value, name and ordinal. |
static FudgeMsgField |
of(FudgeFieldType<?> type,
Object value,
String name,
Short ordinal)
Obtains a field from the type, value, name and ordinal. |
String |
toString()
Gets a string description of the field. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FudgeMsgField(FudgeFieldType<?> type, Object value, String name, Short ordinal)
type
- the Fudge field type, not nullvalue
- the payload value, may be nullname
- the optional field name, null if no nameordinal
- the optional field ordinal, null if no ordinalpublic FudgeMsgField(FudgeField field)
field
- the FudgeMsgField
to copy.Method Detail |
---|
public static FudgeMsgField of(FudgeField field)
If the field is an instance of this class, it is returned, otherwise a new instance is created.
field
- the field to obtain data from, not null
public static FudgeMsgField of(FudgeFieldType<?> type, Object value)
type
- the Fudge field type, not nullvalue
- the payload value, may be null
public static FudgeMsgField of(FudgeFieldType<?> type, Object value, String name)
type
- the Fudge field type, not nullvalue
- the payload value, may be nullname
- the optional field name, null if no name
public static FudgeMsgField of(FudgeFieldType<?> type, Object value, Short ordinal)
type
- the Fudge field type, not nullvalue
- the payload value, may be nullordinal
- the optional field ordinal, null if no ordinal
public static FudgeMsgField of(FudgeFieldType<?> type, Object value, String name, Short ordinal)
type
- the Fudge field type, not nullvalue
- the payload value, may be nullname
- the optional field name, null if no nameordinal
- the optional field ordinal, null if no ordinal
public FudgeFieldType<?> getType()
The type should match the value.
getType
in interface FudgeField
public Object getValue()
The value is the payload of the field.
getValue
in interface FudgeField
public String getName()
The name is a string that identifies the meaning of the data. This is similar to the tag name in XML.
getName
in interface FudgeField
public Short getOrdinal()
The ordinal is a number that identifies the meaning of the data. It is typically a reference into the taxonomy.
getOrdinal
in interface FudgeField
public boolean equals(Object obj)
This checks the type, value, name and ordinal.
equals
in class Object
obj
- the other field, null returns false
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |