com.voytechs.jnetstream.codec
Class FieldImpl

java.lang.Object
  extended by com.voytechs.jnetstream.codec.FieldImpl
All Implemented Interfaces:
Field, Identity, MutableField

public class FieldImpl
extends java.lang.Object
implements Field, MutableField


Field Summary
static java.lang.String VALUE_NAME
           
 
Fields inherited from interface com.voytechs.jnetstream.codec.Field
COMMON, DESCRIPTION, FORMAT, HIDENAME, HIDEVALUE, HTTP, MAX, MIN, MODIFIED, UNITS, UNITVALUE
 
Fields inherited from interface com.voytechs.jnetstream.codec.Identity
SHORT_NAME
 
Constructor Summary
FieldImpl(java.lang.String name, java.util.Map permProperties, Primitive primitive)
           
 
Method Summary
 void addField(Field field)
          Adds a new field to the packet.
 void addNote(Note note)
           
 Field getField(int index)
          Returns the indexed field from the packet.
 Field getField(java.lang.String name)
          Returns the named field from the packet.
 int getFieldCount()
          Returns the size of this packet.
 java.lang.String getName()
          Returns the NAME property of this subclassed object.
 java.util.Map getPermProperties()
           
 Primitive getPrimitive()
          Returns the value Primitive of this field.
 Primitive getProperty(java.lang.String name)
          Returns the Property object as a Primitive.
 boolean getShowNameFlag()
           
 boolean getShowValueFlag()
           
 int getSize()
          Returns the size in bit of the field.
 java.util.Map getTempProperties()
           
 java.lang.Object getValue()
          Conveniece method to retrieve a value of only the field.
 java.lang.Object getValue(java.lang.String name)
          Retrieve the value of the named property or sub field.
 java.lang.String getValueName()
           
 boolean hasFields()
          Returns true if this field has sub fields of its own.
 boolean isMultiLine()
           
 OutputBuffer print(OutputBuffer s, java.lang.String pre)
           
 void setProperty(java.lang.String name, Primitive property)
           
 void setShowNameFlag(boolean stat)
           
 void setShowValueFlag(boolean stat)
           
 void setValueName(java.lang.String name)
           
 java.lang.String toString()
           
 OutputBuffer toStringPost(OutputBuffer s, java.lang.String pre, int max)
           
 OutputBuffer toStringPre(OutputBuffer s, java.lang.String pre)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VALUE_NAME

public static final java.lang.String VALUE_NAME
See Also:
Constant Field Values
Constructor Detail

FieldImpl

public FieldImpl(java.lang.String name,
                 java.util.Map permProperties,
                 Primitive primitive)
Parameters:
-
Throws:
Method Detail

getPrimitive

public Primitive getPrimitive()
Returns the value Primitive of this field.

Specified by:
getPrimitive in interface Field
Returns:
ProtocolPrimitive such as IntergerBigEndian which implements the ProtocolPrimitive interface.

getSize

public int getSize()
Description copied from interface: Field
Returns the size in bit of the field. The field size is defined with the header definition and can be queried using getSize() method call.

Specified by:
getSize in interface Field
Returns:
Size in bit of this field.

hasFields

public boolean hasFields()
Returns true if this field has sub fields of its own.

Specified by:
hasFields in interface Field
Returns:
true means that there are subfields, false indicates that there are no subfields.

setProperty

public void setProperty(java.lang.String name,
                        Primitive property)
Specified by:
setProperty in interface MutableField

addNote

public void addNote(Note note)
Specified by:
addNote in interface MutableField

getProperty

public Primitive getProperty(java.lang.String name)
Description copied from interface: Identity
Returns the Property object as a Primitive. You normally then call the Primitive.getValue() method to retrieve the actual value or use the getPrpertyValue(String) method since it quicker.

Specified by:
getProperty in interface Identity
Returns:
The property object as a Primitive.

getValue

public java.lang.Object getValue(java.lang.String name)
Retrieve the value of the named property or sub field.

Specified by:
getValue in interface Field
Parameters:
name - name of the property or sub field to retrieve the value.
Returns:
Value of the property value as taken from the Primitive.
Since:
JNetStream 0.2.2

getValue

public java.lang.Object getValue()
Conveniece method to retrieve a value of only the field.

Specified by:
getValue in interface Field
Returns:
Opaque value of the field.
Since:
JNetStream 0.2.2

addField

public void addField(Field field)
Adds a new field to the packet.

Specified by:
addField in interface MutableField

getField

public Field getField(java.lang.String name)
Returns the named field from the packet.

Specified by:
getField in interface Field
Returns:
Requested field or null if not found.

getField

public Field getField(int index)
Returns the indexed field from the packet.

Specified by:
getField in interface Field
Returns:
Field requested by the index, or null if out of range.

getFieldCount

public int getFieldCount()
Returns the size of this packet. Size refers to number of fields decoded. Only fields that this codec understands are decoded. There may be additional undecoded fields of other protocoal still in the stack.

Specified by:
getFieldCount in interface Field
Returns:
Number of fields in the packet.

getName

public java.lang.String getName()
Description copied from interface: Identity
Returns the NAME property of this subclassed object.

Specified by:
getName in interface Identity
Returns:
Name of this object.

setValueName

public void setValueName(java.lang.String name)

getValueName

public java.lang.String getValueName()

setShowNameFlag

public void setShowNameFlag(boolean stat)

setShowValueFlag

public void setShowValueFlag(boolean stat)

getShowNameFlag

public boolean getShowNameFlag()

getShowValueFlag

public boolean getShowValueFlag()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

print

public OutputBuffer print(OutputBuffer s,
                          java.lang.String pre)

toStringPre

public OutputBuffer toStringPre(OutputBuffer s,
                                java.lang.String pre)

isMultiLine

public boolean isMultiLine()

toStringPost

public OutputBuffer toStringPost(OutputBuffer s,
                                 java.lang.String pre,
                                 int max)

getPermProperties

public java.util.Map getPermProperties()

getTempProperties

public java.util.Map getTempProperties()