Package de.gsi.serializer.spi
Class WireDataFieldDescription
- java.lang.Object
-
- de.gsi.serializer.spi.WireDataFieldDescription
-
- All Implemented Interfaces:
FieldDescription
- Direct Known Subclasses:
ProtocolInfo
public class WireDataFieldDescription extends java.lang.Object implements FieldDescription
Field header descriptor- Author:
- rstein
-
-
Constructor Summary
Constructors Constructor Description WireDataFieldDescription(IoSerialiser source, FieldDescription parent, int fieldNameHashCode, java.lang.String fieldName, DataType dataType, int fieldStart, int dataStartOffset, int dataSize)Constructs new serializer field header
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectdata(DataType... overwriteType)booleanequals(java.lang.Object obj)FieldDescriptionfindChildField(int fieldNameHashCode, java.lang.String fieldName)FieldDescriptionfindChildField(java.lang.String fieldName)java.util.List<FieldDescription>getChildren()intgetDataSize()intgetDataStartOffset()intgetDataStartPosition()DataTypegetDataType()java.lang.StringgetFieldDescription()java.lang.StringgetFieldDirection()Return optional meta data tag describing the 'direction' of this data field.java.util.List<java.lang.String>getFieldGroups()java.lang.StringgetFieldName()intgetFieldNameHashCode()intgetFieldStart()java.lang.StringgetFieldUnit()IoSerialisergetIoSerialiser()FieldDescriptiongetParent()java.lang.Class<?>getType()inthashCode()booleanisAnnotationPresent()voidprintFieldStructure()Prints the class field structure to the logging output for diagnostics purposes starting from this element as a root.protected static voidprintFieldStructure(FieldDescription field, int recursionLevel)voidsetDataSize(int size)voidsetFieldDescription(java.lang.String fieldDescription)voidsetFieldDirection(java.lang.String fieldDirection)voidsetFieldGroups(java.util.List<java.lang.String> fieldGroups)voidsetFieldUnit(java.lang.String fieldUnit)java.lang.StringtoString()
-
-
-
Constructor Detail
-
WireDataFieldDescription
public WireDataFieldDescription(IoSerialiser source, FieldDescription parent, int fieldNameHashCode, java.lang.String fieldName, DataType dataType, int fieldStart, int dataStartOffset, int dataSize)
Constructs new serializer field header- Parameters:
source- the referenced IoBuffer (if any)parent- the optional parent field header (for cascaded objects)fieldNameHashCode- the fairly-unique hash-code of the field name, N.B. checked during 1st iteration against fieldName, if no collisions are present then this check is being suppressedfieldName- the clear text field name descriptiondataType- the data type of that fieldfieldStart- the absolute buffer position from which the field header can be parseddataStartOffset- the position from which the actual data can be parsed onwardsdataSize- the expected number of bytes to skip the data block
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
findChildField
public FieldDescription findChildField(java.lang.String fieldName)
- Specified by:
findChildFieldin interfaceFieldDescription
-
findChildField
public FieldDescription findChildField(int fieldNameHashCode, java.lang.String fieldName)
- Specified by:
findChildFieldin interfaceFieldDescription
-
getChildren
public java.util.List<FieldDescription> getChildren()
- Specified by:
getChildrenin interfaceFieldDescription
-
getDataSize
public int getDataSize()
- Specified by:
getDataSizein interfaceFieldDescription- Returns:
- the data size in bytes stored after the field header
-
setDataSize
public void setDataSize(int size)
-
getDataStartOffset
public int getDataStartOffset()
- Specified by:
getDataStartOffsetin interfaceFieldDescription- Returns:
- the offset in bytes from the field start position until the first data object can be read. (N.B. equals to 'getFieldstart() + getDataOffset()', the data ends at 'getDataStartOffset() + getDataSize()'
-
getDataStartPosition
public int getDataStartPosition()
- Specified by:
getDataStartPositionin interfaceFieldDescription- Returns:
- the buffer byte position from where the first data object can be read
-
getDataType
public DataType getDataType()
- Specified by:
getDataTypein interfaceFieldDescription- Returns:
- the stored data type, see
DataTypefor details
-
getFieldDescription
public java.lang.String getFieldDescription()
- Specified by:
getFieldDescriptionin interfaceFieldDescription- Returns:
- optional meta data tag describing the purpose of this data field (N.B. can be empty String)
-
setFieldDescription
public void setFieldDescription(java.lang.String fieldDescription)
-
getFieldDirection
public java.lang.String getFieldDirection()
Description copied from interface:FieldDescriptionReturn optional meta data tag describing the 'direction' of this data field. The information encodes the source servicedevelopers intend to the receiving user whether the field can be, for example, modified (get/set), set-only, or read-only, or attach any other similar information. Encoding/interpretation is left ad-lib to the source service developer.- Specified by:
getFieldDirectionin interfaceFieldDescription- Returns:
- optional meta data (N.B. can be empty String).
-
setFieldDirection
public void setFieldDirection(java.lang.String fieldDirection)
-
getFieldGroups
public java.util.List<java.lang.String> getFieldGroups()
- Specified by:
getFieldGroupsin interfaceFieldDescription- Returns:
- optional meta data tag describing the group/set this data field belongs to (N.B. can be empty String, corresponding to 'all')
-
setFieldGroups
public void setFieldGroups(java.util.List<java.lang.String> fieldGroups)
-
getFieldName
public java.lang.String getFieldName()
- Specified by:
getFieldNamein interfaceFieldDescription- Returns:
- the data field's name
-
getFieldNameHashCode
public int getFieldNameHashCode()
- Specified by:
getFieldNameHashCodein interfaceFieldDescription- Returns:
- the data field name's hashcode (N.B. used for faster identification of the field)
-
getFieldStart
public int getFieldStart()
- Specified by:
getFieldStartin interfaceFieldDescription- Returns:
- buffer position in byte where the data field header starts
-
getFieldUnit
public java.lang.String getFieldUnit()
- Specified by:
getFieldUnitin interfaceFieldDescription- Returns:
- optional meta data tag describing the field's SI unit or similar (N.B. can be empty String)
-
setFieldUnit
public void setFieldUnit(java.lang.String fieldUnit)
-
data
public java.lang.Object data(DataType... overwriteType)
- Parameters:
overwriteType- optional DataType as which the data should be interpreted- Returns:
- raw ioSerialiser reference this field was retrieved with the position in the underlying IoBuffer at the to be read field N.B. this is a safe convenience method and not performance optimised
-
getIoSerialiser
public IoSerialiser getIoSerialiser()
- Returns:
- raw ioSerialiser reference this field was retrieved from w/o changing the position in the underlying IoBuffer
-
getParent
public FieldDescription getParent()
- Specified by:
getParentin interfaceFieldDescription- Returns:
- for a hierarchical/nested data structure refers to the parent this field belongs to (N.B. can be null if there isn't a parent, e.g. for a root element)
-
getType
public java.lang.Class<?> getType()
- Specified by:
getTypein interfaceFieldDescription
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
isAnnotationPresent
public boolean isAnnotationPresent()
- Specified by:
isAnnotationPresentin interfaceFieldDescription
-
printFieldStructure
public void printFieldStructure()
Description copied from interface:FieldDescriptionPrints the class field structure to the logging output for diagnostics purposes starting from this element as a root. N.B. regarding formatting/parsing The indentation depth is controlled viaClassUtils.setIndentationNumberOfSpace(int). The max recursion depth during the class structure parsing is controlled viaClassUtils.setMaxRecursionDepth(int).- Specified by:
printFieldStructurein interfaceFieldDescription
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
printFieldStructure
protected static void printFieldStructure(FieldDescription field, int recursionLevel)
-
-