Class WireDataFieldDescription

    • 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 suppressed
        fieldName - the clear text field name description
        dataType - the data type of that field
        fieldStart - the absolute buffer position from which the field header can be parsed
        dataStartOffset - the position from which the actual data can be parsed onwards
        dataSize - the expected number of bytes to skip the data block
    • Method Detail

      • equals

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

        public int getDataSize()
        Specified by:
        getDataSize in interface FieldDescription
        Returns:
        the data size in bytes stored after the field header
      • setDataSize

        public void setDataSize​(int size)
      • getDataStartOffset

        public int getDataStartOffset()
        Specified by:
        getDataStartOffset in interface FieldDescription
        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:
        getDataStartPosition in interface FieldDescription
        Returns:
        the buffer byte position from where the first data object can be read
      • getFieldDescription

        public java.lang.String getFieldDescription()
        Specified by:
        getFieldDescription in interface FieldDescription
        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: FieldDescription
        Return 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:
        getFieldDirection in interface FieldDescription
        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:
        getFieldGroups in interface FieldDescription
        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:
        getFieldName in interface FieldDescription
        Returns:
        the data field's name
      • getFieldNameHashCode

        public int getFieldNameHashCode()
        Specified by:
        getFieldNameHashCode in interface FieldDescription
        Returns:
        the data field name's hashcode (N.B. used for faster identification of the field)
      • getFieldStart

        public int getFieldStart()
        Specified by:
        getFieldStart in interface FieldDescription
        Returns:
        buffer position in byte where the data field header starts
      • getFieldUnit

        public java.lang.String getFieldUnit()
        Specified by:
        getFieldUnit in interface FieldDescription
        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:
        getParent in interface FieldDescription
        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)
      • hashCode

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

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

        protected static void printFieldStructure​(FieldDescription field,
                                                  int recursionLevel)