Class DynamicTypeSection

java.lang.Object
org.refcodes.serial.SequenceSection
org.refcodes.serial.DynamicTypeSection
All Implemented Interfaces:
Serializable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.EncodingAccessor<Charset>, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.PayloadAccessor<Sequence>, org.refcodes.mixin.PayloadAccessor.PayloadBuilder<Sequence,PayloadTransmission<Sequence>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<Sequence>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<Sequence>, org.refcodes.mixin.Resetable, org.refcodes.mixin.Schemable, org.refcodes.numerical.EndianessAccessor, DynamicTypeTransmission, LengthWidthAccessor, PayloadSection<Sequence>, PayloadTransmission<Sequence>, Section, Section.SectionMixin, Transmission, Transmission.TransmissionMixin

public class DynamicTypeSection extends SequenceSection implements Section, LengthWidthAccessor, org.refcodes.numerical.EndianessAccessor, org.refcodes.mixin.EncodingAccessor<Charset>, DynamicTypeTransmission
The DynamicTypeSection represents a Section which's internal raw data is created from provided types at runtime and which's internal raw data is used to create provided types at runtime. Therefore internally it just consists of a Sequence which is created if necessary from a provided type or from which a provided type is instantiated if necessary.
See Also:
  • Constructor Details

    • DynamicTypeSection

      public DynamicTypeSection()
    • DynamicTypeSection

      public DynamicTypeSection(Charset aCharset)
      Parameters:
      aCharset - The Charset to be used for encoding and decoding String instances.
    • DynamicTypeSection

      public DynamicTypeSection(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
      Constructs the DynamicTypeSection with the given properties as well as with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
    • DynamicTypeSection

      public DynamicTypeSection(int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
      Constructs the DynamicTypeSection with the given properties.
      Parameters:
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
      aCharset - The Charset to be used for encoding and decoding String instances.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias)
      Parameters:
      aAlias - The alias which identifies the content of this segment.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, Charset aCharset)
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aCharset - The Charset to be used for encoding and decoding String instances.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
      Constructs the DynamicTypeSection with the given properties as well as with the TransmissionMetrics.DEFAULT_ENCODING.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
      Constructs the DynamicTypeSection with the given properties.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
      aCharset - The Charset to be used for encoding and decoding String instances.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue)
      Constructs the DynamicTypeSection with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH, TransmissionMetrics.DEFAULT_ENDIANESS as well as TransmissionMetrics.DEFAULT_ENCODING). It is pre-initialized with the given value as of fromType(Object).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, Charset aCharset)
      Constructs the DynamicTypeSection with the given CharSection, as well as with the TransmissionMetrics.DEFAULT_LENGTH_WIDTH and the TransmissionMetrics.DEFAULT_ENDIANESS. It is pre-initialized with the given value as of fromType(Object).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aCharset - The Charset to be used for encoding and decoding String instances.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, Charset aCharset, String... aAttributes)
      Constructs the DynamicTypeSection with the given CharSection, as well as with the TransmissionMetrics.DEFAULT_LENGTH_WIDTH and the TransmissionMetrics.DEFAULT_ENDIANESS. It is pre-initialized with the given value as of fromType(Object, String...).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aCharset - The Charset to be used for encoding and decoding String instances.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
      Constructs the DynamicTypeSection with the given properties as well as with the TransmissionMetrics.DEFAULT_ENCODING. It is pre-initialized with the given value as of fromType(Object).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
      Constructs the DynamicTypeSection with the given properties. It is pre-initialized with the given value as of fromType(Object).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
      aCharset - The Charset to be used for encoding and decoding String instances.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset, String... aAttributes)
      Constructs the DynamicTypeSection with the given properties. It is pre-initialized with the given value as of fromType(Object, String...).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
      aCharset - The Charset to be used for encoding and decoding String instances.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aAttributes)
      Constructs the DynamicTypeSection with the given properties as well as with the TransmissionMetrics.DEFAULT_ENCODING. It is pre-initialized with the given value as of fromType(Object, String...).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, String... aAttributes)
      Constructs the DynamicTypeSection with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH, TransmissionMetrics.DEFAULT_ENDIANESS as well as TransmissionMetrics.DEFAULT_ENCODING). It is pre-initialized with the given value as of fromType(Object, String...).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, TransmissionMetrics aTransmissionMetrics)
      Constructs the DynamicTypeSection with the given properties. It is pre-initialized with the given value as of fromType(Object). The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, T aValue, TransmissionMetrics aTransmissionMetrics, String... aAttributes)
      Constructs the DynamicTypeSection with the given properties. It is pre-initialized with the given value as of fromType(Object, String...). The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The data structure's value.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(String aAlias, TransmissionMetrics aTransmissionMetrics)
      Constructs the DynamicTypeSection with the given properties. The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue)
      Constructs the DynamicTypeSection with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH, TransmissionMetrics.DEFAULT_ENDIANESS as well as TransmissionMetrics.DEFAULT_ENCODING). It is pre-initialized with the given value as of fromType(Object).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, Charset aCharset)
      Constructs the DynamicTypeSection with the given CharSection, as well as with the TransmissionMetrics.DEFAULT_LENGTH_WIDTH and the TransmissionMetrics.DEFAULT_ENDIANESS. It is pre-initialized with the given value as of fromType(Object).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aCharset - The Charset to be used for encoding and decoding String instances.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, Charset aCharset, String... aAttributes)
      Constructs the DynamicTypeSection with the given CharSection, as well as with the TransmissionMetrics.DEFAULT_LENGTH_WIDTH and the TransmissionMetrics.DEFAULT_ENDIANESS. It is pre-initialized with the given value as of fromType(Object, String...).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aCharset - The Charset to be used for encoding and decoding String instances.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess)
      Constructs the DynamicTypeSection with the given properties as well as with the TransmissionMetrics.DEFAULT_ENCODING. It is pre-initialized with the given value as of fromType(Object).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset)
      Constructs the DynamicTypeSection with the given properties. It is pre-initialized with the given value as of fromType(Object).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
      aCharset - The Charset to be used for encoding and decoding String instances.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, Charset aCharset, String... aAttributes)
      Constructs the DynamicTypeSection with the given properties. It is pre-initialized with the given value as of fromType(Object, String...).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
      aCharset - The Charset to be used for encoding and decoding String instances.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, int aLengthWidth, org.refcodes.numerical.Endianess aEndianess, String... aAttributes)
      Constructs the DynamicTypeSection with the given properties as well as with the TransmissionMetrics.DEFAULT_ENCODING. It is pre-initialized with the given value as of fromType(Object, String...).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aLengthWidth - The width (in bytes) to be used for length values.
      aEndianess - The Endianess to be used for (length) values.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, String... aAttributes)
      Constructs the DynamicTypeSection with the default properties (TransmissionMetrics.DEFAULT_LENGTH_WIDTH, TransmissionMetrics.DEFAULT_ENDIANESS as well as TransmissionMetrics.DEFAULT_ENCODING). It is pre-initialized with the given value as of fromType(Object, String...).
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, TransmissionMetrics aTransmissionMetrics)
      Constructs the DynamicTypeSection with the given properties. It is pre-initialized with the given value as of fromType(Object). The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • DynamicTypeSection

      public DynamicTypeSection(T aValue, TransmissionMetrics aTransmissionMetrics, String... aAttributes)
      Constructs the DynamicTypeSection with the given properties. It is pre-initialized with the given value as of fromType(Object, String...). The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • DynamicTypeSection

      public DynamicTypeSection(TransmissionMetrics aTransmissionMetrics)
      Constructs the DynamicTypeSection with the given properties. The configuration attributes are taken from the TransmissionMetrics configuration object, though only those attributes are supported which are also supported by the other constructors!
      Parameters:
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
  • Method Details

    • fromType

      public <T> void fromType(T aValue)
      Constructs the DynamicTypeSection's Sequence from the given type's instance . The attributes of the given data structure are processed all and in alphabetical order. For specifying a predefined set of attributes and their order, please invoke DynamicTypeTransmission.fromType(Object, String[]) instead!
      Specified by:
      fromType in interface DynamicTypeTransmission
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
    • fromType

      public <T> void fromType(T aValue, String... aAttributes)
      Constructs an instance for the given type T. . The attributes of the given data structure are processed using the predefined set of attributes in their according order.
      Specified by:
      fromType in interface DynamicTypeTransmission
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aValue - The data structure's value.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
    • getEncoding

      public Charset getEncoding()
      Specified by:
      getEncoding in interface org.refcodes.mixin.EncodingAccessor<Charset>
    • getEndianess

      public org.refcodes.numerical.Endianess getEndianess()
      Specified by:
      getEndianess in interface org.refcodes.numerical.EndianessAccessor
    • getLengthWidth

      public int getLengthWidth()
      Retrieves the length width (in bytes) from the length width (in bytes) property.
      Specified by:
      getLengthWidth in interface LengthWidthAccessor
      Returns:
      The length width (in bytes) stored by the length width (in bytes) property.
    • reset

      public void reset()
      Resets any dynamic data (e.g. values such as payloads or checksums) and must not(!) reset any configurations or settings required to produce the dynamic data (e.g. the TransmissionMetrics).
      Specified by:
      reset in interface org.refcodes.mixin.Resetable
      Specified by:
      reset in interface Transmission
      Overrides:
      reset in class SequenceSection
    • toSchema

      public SerialSchema toSchema()
      Specified by:
      toSchema in interface org.refcodes.mixin.Schemable
      Specified by:
      toSchema in interface Transmission
      Overrides:
      toSchema in class SequenceSection
    • toSimpleTypeMap

      public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()
      Returns the SimpleTypeMap representation of this Transmission. In case this Transmission has Transmission children, then the children are queried as well and contained in the resulting SimpleTypeMap. The aliases of the according Transmission instances represent the resulting path to a Transmission's final simple type.
      Specified by:
      toSimpleTypeMap in interface Transmission
      Overrides:
      toSimpleTypeMap in class SequenceSection
      Returns:
      The SimpleTypeMap representing this Transmission and (if any) its children, with the according aliases forming the paths to the Transmission's values.
    • toType

      public <T> T toType(Class<T> aType)
      Constructs an instance for the given type T. The attributes of the given data structure are processed all and in alphabetical order. For specifying a predefined set of attributes and their order, please invoke DynamicTypeTransmission.fromType(Object, String...) instead!
      Specified by:
      toType in interface DynamicTypeTransmission
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aType - The data structure's type.
      Returns:
      The according type constructed from the DynamicTypeSection's Sequence.
    • toType

      public <T> T toType(Class<T> aType, String... aAttributes)
      Constructs an instance for the given type T. . The attributes of the given data structure are processed using the predefined set of attributes in their according order
      Specified by:
      toType in interface DynamicTypeTransmission
      Type Parameters:
      T - The type of the data structure representing the body.
      Parameters:
      aType - The data structure's type.
      aAttributes - The attributes or null if all attributes are to be processed in alphabetical order.
      Returns:
      The according type constructed from the DynamicTypeSection's Sequence.