org.openfast.template
Class Group

java.lang.Object
  extended by org.openfast.template.Field
      extended by org.openfast.template.Group
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
MessageTemplate

public class Group
extends Field

See Also:
Serialized Form

Field Summary
protected  java.lang.String childNamespace
           
protected  Field[] fieldDefinitions
           
protected  java.util.Map fieldIdMap
           
protected  java.util.Map fieldIndexMap
           
protected  java.util.Map fieldNameMap
           
protected  Field[] fields
           
protected  java.util.Map introspectiveFieldMap
           
protected  StaticTemplateReference[] staticTemplateReferences
           
protected  boolean usesPresenceMap
           
 
Fields inherited from class org.openfast.template.Field
id, key, name, optional
 
Constructor Summary
Group(QName name, Field[] fields, boolean optional)
           
Group(java.lang.String name, Field[] fields, boolean optional)
           
 
Method Summary
 FieldValue createValue(java.lang.String value)
          createValue method declaration
 FieldValue decode(java.io.InputStream in, Group group, Context context, BitVectorReader pmapReader)
          FieldValue decode method declaration
 FieldValue[] decodeFieldValues(java.io.InputStream in, Group template, BitVectorReader pmapReader, Context context)
          Goes through the all the field value array, starting with the index passed, checks to see if a map actually created for the field to pass to the decoder - the field index is created as a new Group object and stored to the the FieldValue array.
protected  FieldValue[] decodeFieldValues(java.io.InputStream in, Group template, Context context)
          If there is not a vector map created for the inputStream, a vector map will be created to pass to the public decodeFieldValues method.
 byte[] encode(FieldValue value, Group template, Context context)
          If there is no BitVector, this encoding method will create one.
 byte[] encode(FieldValue value, Group template, Context context, BitVectorBuilder presenceMapBuilder)
          If your FieldValue already has a BitVector, use this encode method.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getChildNamespace()
           
 Field getField(int index)
          Find the field object of the index passed
 Field getField(QName name)
           
 Field getField(java.lang.String fieldName)
          Find the field object of the passed field name
 Field getFieldById(java.lang.String id)
           
 int getFieldCount()
          Find the number of total fields
 Field[] getFieldDefinitions()
           
 int getFieldIndex(Field field)
           
 int getFieldIndex(java.lang.String fieldName)
          Find the index of the passed field name as an integer
 Field[] getFields()
           
 Group getGroup(java.lang.String fieldName)
          Find the group with the passed fieldName
 Scalar getIntrospectiveField(java.lang.String fieldName)
           
 Scalar getScalar(int index)
           
 Scalar getScalar(java.lang.String fieldName)
          Get the Scalar Value of the passed fieldName
 Sequence getSequence(java.lang.String fieldName)
          Get the Sequence of the passed fieldName
 StaticTemplateReference getStaticTemplateReference(QName name)
           
 StaticTemplateReference getStaticTemplateReference(java.lang.String name)
           
 StaticTemplateReference[] getStaticTemplateReferences()
           
 java.lang.String getTypeName()
          getTypeName method declaration
 QName getTypeReference()
           
 java.lang.Class getValueType()
          getValueType method declaration
 boolean hasField(QName fieldName)
           
 boolean hasField(java.lang.String fieldName)
          Determine if the map has a specified field name.
 boolean hasFieldWithId(java.lang.String id)
           
 int hashCode()
           
 boolean hasIntrospectiveField(java.lang.String fieldName)
           
 boolean hasTypeReference()
           
 boolean isPresenceMapBitSet(byte[] encoding, FieldValue fieldValue)
          Determine if there is a Map of the passed byte array and fieldValue
 void setChildNamespace(java.lang.String childNamespace)
           
 void setTypeReference(QName typeReference)
          Set the name of the type referenced by this group
 java.lang.String toString()
           
 boolean usesPresenceMap()
           
 boolean usesPresenceMapBit()
          usesPresenceMapBit method declaration
 
Methods inherited from class org.openfast.template.Field
addAttribute, getAttribute, getId, getKey, getName, getQName, hasAttribute, isOptional, isPresent, setId, setKey
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

childNamespace

protected java.lang.String childNamespace

fields

protected final Field[] fields

fieldIndexMap

protected final java.util.Map fieldIndexMap

fieldIdMap

protected final java.util.Map fieldIdMap

fieldNameMap

protected final java.util.Map fieldNameMap

usesPresenceMap

protected final boolean usesPresenceMap

staticTemplateReferences

protected final StaticTemplateReference[] staticTemplateReferences

fieldDefinitions

protected final Field[] fieldDefinitions

introspectiveFieldMap

protected final java.util.Map introspectiveFieldMap
Constructor Detail

Group

public Group(java.lang.String name,
             Field[] fields,
             boolean optional)

Group

public Group(QName name,
             Field[] fields,
             boolean optional)
Method Detail

encode

public byte[] encode(FieldValue value,
                     Group template,
                     Context context,
                     BitVectorBuilder presenceMapBuilder)
If your FieldValue already has a BitVector, use this encode method. The MapBuilder index is kept track of and stored through this process. The supplied data is stored to a byte buffer array and returned.

Specified by:
encode in class Field
Parameters:
value - The value of the FieldValue to be encoded
template - The Group object to be encoded
context - The previous object to keep the data in sync
presenceMapBuilder - The BitVector object that will be used to encode.
Returns:
Returns the encoded byte array

encode

public byte[] encode(FieldValue value,
                     Group template,
                     Context context)
If there is no BitVector, this encoding method will create one. The supplied data is stored to a byte buffer array and returned. The MapBuilder index is kept track of and stored through this process.

Parameters:
value - The value of the FieldValue to be encoded
template - The Group object to be encoded
context - The previous object to keep the data in sync
Returns:
Returns an new byte array if there are no FieldValue to encode, otherwise returns the buffer to the byte array that the data was stored to

decode

public FieldValue decode(java.io.InputStream in,
                         Group group,
                         Context context,
                         BitVectorReader pmapReader)
Description copied from class: Field
FieldValue decode method declaration

Specified by:
decode in class Field
Parameters:
in - The InputStream to be decoded
group - The Group object to be decoded
context - The previous object to keep the data in sync
present -
Returns:
Returns a new GroupValue

decodeFieldValues

protected FieldValue[] decodeFieldValues(java.io.InputStream in,
                                         Group template,
                                         Context context)
If there is not a vector map created for the inputStream, a vector map will be created to pass to the public decodeFieldValues method.

Parameters:
in - The InputStream to be decoded
template - The Group object to be decoded
context - The previous object to keep the data in sync
Returns:
Returns the FieldValue array of the decoded field values passed to it

decodeFieldValues

public FieldValue[] decodeFieldValues(java.io.InputStream in,
                                      Group template,
                                      BitVectorReader pmapReader,
                                      Context context)
Goes through the all the field value array, starting with the index passed, checks to see if a map actually created for the field to pass to the decoder - the field index is created as a new Group object and stored to the the FieldValue array. Once all the field values have beed gone through, the method returns.

Parameters:
in - The InputStream to be decoded
template - The Group object
pmap - The BitVector to be decoded
context - The previous object to keep the data in sync
start - The index of the Field to start decoding from
Returns:
Returns a FieldValue array of the decoded field values passed to it.
Throws:
Throws - RuntimeException if there is an problem in the decoding

isPresenceMapBitSet

public boolean isPresenceMapBitSet(byte[] encoding,
                                   FieldValue fieldValue)
Determine if there is a Map of the passed byte array and fieldValue

Specified by:
isPresenceMapBitSet in class Field
Parameters:
encoding - The byte array to be checked
fieldValue - The fieldValue to be checked
Returns:
Returns true if there is a PrecenceMapBit of the specified byte array and field, false otherwise

usesPresenceMapBit

public boolean usesPresenceMapBit()
Description copied from class: Field
usesPresenceMapBit method declaration

Specified by:
usesPresenceMapBit in class Field
Returns:
Returns the optional boolean of the MapBit

usesPresenceMap

public boolean usesPresenceMap()

getFieldCount

public int getFieldCount()
Find the number of total fields

Returns:
Returns the number of fields

getField

public Field getField(int index)
Find the field object of the index passed

Parameters:
index - The index within the field that is being searched for
Returns:
Returns a field object of the specified index

getValueType

public java.lang.Class getValueType()
Description copied from class: Field
getValueType method declaration

Specified by:
getValueType in class Field
Returns:
Returns the class of the GroupValue

createValue

public FieldValue createValue(java.lang.String value)
Description copied from class: Field
createValue method declaration

Specified by:
createValue in class Field
Parameters:
value - The value that the fieldValue that is to be created
Returns:
Returns a new GroupValue

getTypeName

public java.lang.String getTypeName()
Description copied from class: Field
getTypeName method declaration

Specified by:
getTypeName in class Field
Returns:
Returns the string 'group'

getField

public Field getField(java.lang.String fieldName)
Find the field object of the passed field name

Parameters:
fieldName - The field name of the field object that is to be returned
Returns:
Returns the field object of the passed field name

getField

public Field getField(QName name)

getFieldIndex

public int getFieldIndex(java.lang.String fieldName)
Find the index of the passed field name as an integer

Parameters:
fieldName - The field name that is being searched for
Returns:
Returns an integer of the field index of the specified field name

getFieldIndex

public int getFieldIndex(Field field)

getSequence

public Sequence getSequence(java.lang.String fieldName)
Get the Sequence of the passed fieldName

Parameters:
fieldName - The field name that is being searched for
Returns:
Returns a sequence object of the specified fieldName

getScalar

public Scalar getScalar(java.lang.String fieldName)
Get the Scalar Value of the passed fieldName

Parameters:
fieldName - The field name that is being searched for
Returns:
Returns a Scalar value of the specified fieldName

getScalar

public Scalar getScalar(int index)

getGroup

public Group getGroup(java.lang.String fieldName)
Find the group with the passed fieldName

Parameters:
fieldName - The field name that is being searched for
Returns:
Returns a Group object of the specified field name

hasField

public boolean hasField(java.lang.String fieldName)
Determine if the map has a specified field name.

Parameters:
fieldName - The name of the fieldName that is being searched for
Returns:
Returns true if there is the field name that was passed in the Map, false otherwise

hasField

public boolean hasField(QName fieldName)

getFields

public Field[] getFields()
Returns:
Returns an array of Fields

setTypeReference

public void setTypeReference(QName typeReference)
Set the name of the type referenced by this group

Parameters:
typeReference - The name of the application type referenced by this goup

getTypeReference

public QName getTypeReference()
Returns:
Returns the application type referenced by this group

hasTypeReference

public boolean hasTypeReference()
Returns:
Returns true if the type has a reference, false otherwise

toString

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hasFieldWithId

public boolean hasFieldWithId(java.lang.String id)

getFieldById

public Field getFieldById(java.lang.String id)

getChildNamespace

public java.lang.String getChildNamespace()

setChildNamespace

public void setChildNamespace(java.lang.String childNamespace)

getStaticTemplateReferences

public StaticTemplateReference[] getStaticTemplateReferences()

getStaticTemplateReference

public StaticTemplateReference getStaticTemplateReference(java.lang.String name)

getStaticTemplateReference

public StaticTemplateReference getStaticTemplateReference(QName name)

getFieldDefinitions

public Field[] getFieldDefinitions()

hasIntrospectiveField

public boolean hasIntrospectiveField(java.lang.String fieldName)

getIntrospectiveField

public Scalar getIntrospectiveField(java.lang.String fieldName)


Copyright © 2006-2008 The LaSalle Technology Group, LLC. All Rights Reserved.