Class PropertiesSection

java.lang.Object
org.refcodes.serial.AbstractPayloadSection<org.refcodes.properties.Properties>
org.refcodes.serial.PropertiesSection
All Implemented Interfaces:
Serializable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.EncodingAccessor<Charset>, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.PayloadAccessor<org.refcodes.properties.Properties>, org.refcodes.mixin.PayloadAccessor.PayloadBuilder<org.refcodes.properties.Properties,PayloadTransmission<org.refcodes.properties.Properties>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<org.refcodes.properties.Properties>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<org.refcodes.properties.Properties>, org.refcodes.mixin.Schemable<SerialSchema>, PayloadSection<org.refcodes.properties.Properties>, PayloadTransmission<org.refcodes.properties.Properties>, Section, Section.SectionMixin, Transmission, Transmission.TransmissionMixin

public class PropertiesSection extends AbstractPayloadSection<org.refcodes.properties.Properties> implements Section, org.refcodes.mixin.EncodingAccessor<Charset>
The PropertiesSection is an implementation of a Section carrying a String as payload.
See Also:
  • Constructor Details

    • PropertiesSection

      public PropertiesSection(org.refcodes.properties.Properties aPayload, TransmissionMetrics aTransmissionMetrics)
      Constructs a PropertiesSection with the given Properties payload being encoded with the given Charset. The properties from the payload are copied into the PropertiesSection. 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:
      aPayload - The payload to be contained by the Section.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • PropertiesSection

      public PropertiesSection(String aAlias, org.refcodes.properties.Properties aPayload, TransmissionMetrics aTransmissionMetrics)
      Constructs a PropertiesSection with the given Properties payload being encoded with the given Charset. The properties from the payload are copied into the PropertiesSection. 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.
      aPayload - The payload to be contained by the Section.
      aTransmissionMetrics - The TransmissionMetrics to be used for configuring this instance.
    • PropertiesSection

      public PropertiesSection()
      Constructs an empty PropertiesSection using UTF-8 encoding for the payload.
    • PropertiesSection

      public PropertiesSection(org.refcodes.properties.Properties aPayload)
      Constructs a PropertiesSection with the given Properties payload being UTF-8 encoded. The properties from the payload are copied into the PropertiesSection.
      Parameters:
      aPayload - The payload to be contained by the Section.
    • PropertiesSection

      public PropertiesSection(Charset aCharset)
      Constructs a PropertiesSection with a payload expected to be encoded with the given Charset.
      Parameters:
      aCharset - The Charset to be used for encoding the String.
    • PropertiesSection

      public PropertiesSection(org.refcodes.properties.Properties aPayload, Charset aCharset)
      Constructs a PropertiesSection with the given Properties payload being encoded with the given Charset. The properties from the payload are copied into the PropertiesSection.
      Parameters:
      aPayload - The payload to be contained by the Section.
      aCharset - The Charset to be used for encoding the String.
    • PropertiesSection

      public PropertiesSection(String aAlias)
      Constructs an empty PropertiesSection using UTF-8 encoding for the payload.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
    • PropertiesSection

      public PropertiesSection(String aAlias, org.refcodes.properties.Properties aPayload)
      Constructs a PropertiesSection with the given Properties payload being UTF-8 encoded. The properties from the payload are copied into the PropertiesSection.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aPayload - The payload to be contained by the Section.
    • PropertiesSection

      public PropertiesSection(String aAlias, Charset aCharset)
      Constructs a PropertiesSection with a payload expected to be encoded with the given Charset.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aCharset - The Charset to be used for encoding the String.
    • PropertiesSection

      public PropertiesSection(String aAlias, org.refcodes.properties.Properties aPayload, Charset aCharset)
      Constructs a PropertiesSection with the given Properties payload being encoded with the given Charset. The properties from the payload are copied into the PropertiesSection.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aPayload - The payload to be contained by the Section.
      aCharset - The Charset to be used for encoding the String.
  • Method Details

    • toSequence

      public Sequence toSequence()
      Provides the Sequence representation of this Transmission. In case of nested Transmission instances, all Sequence representations from all sub-segments are accumulated to the result as well. Caution, the Transmission (or its nested Transmission instances) may be backed by the returned Sequence.
      Specified by:
      toSequence in interface Transmission
      Returns:
      The according instance's Sequence.
    • fromTransmission

      public void fromTransmission(Sequence aSequence, int aOffset, int aLength) throws TransmissionException
      (Re-)initializes this instance with the the given Sequence data.
      Specified by:
      fromTransmission in interface Section
      Parameters:
      aSequence - The Sequence data from which to (re-)initialize this instance.
      aOffset - The offset where to start processing the provided Sequence.
      aLength - The length of data assigned by the Sequence.
      Throws:
      TransmissionException - thrown in case a given Sequence cannot be processed.
    • getLength

      public int getLength()
      Determines the overall length of this Transmission. In case of nested Transmission instances, all length values from all sub-segments are accumulated to the result as well.
      Specified by:
      getLength in interface org.refcodes.mixin.LengthAccessor
      Specified by:
      getLength in interface Transmission
      Returns:
      The (overall) length of the Transmission (including any sub-segments).
    • toSchema

      public SerialSchema toSchema()
      Retrieves the SerialSchema representing the Transmission. Retrieving a SerialSchema is useful when analyzing and debugging data structures such as a AllocSectionDecoratorSegment instance to help document, learn and verify on the structure (as well as the content) of that very AllocSectionDecoratorSegment.
      Specified by:
      toSchema in interface org.refcodes.mixin.Schemable<SerialSchema>
      Specified by:
      toSchema in interface Transmission
      Returns:
      The SerialSchema representation of the implementing type for debugging and verification (or documentation) purposes.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractPayloadSection<org.refcodes.properties.Properties>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractPayloadSection<org.refcodes.properties.Properties>
    • withPayload

      public PropertiesSection withPayload(org.refcodes.properties.Properties aValue)
      Specified by:
      withPayload in interface org.refcodes.mixin.PayloadAccessor.PayloadBuilder<org.refcodes.properties.Properties,PayloadTransmission<org.refcodes.properties.Properties>>
    • 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 AbstractPayloadSection<org.refcodes.properties.Properties>
      Returns:
      The SimpleTypeMap representing this Transmission and (if any) its children, with the according aliases forming the paths to the Transmission's values.
    • getEncoding

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