Class AbstractPayloadSegment<T>

java.lang.Object
org.refcodes.serial.AbstractPayloadSegment<T>
Type Parameters:
T - The type of the segment's payload.
All Implemented Interfaces:
Serializable, org.refcodes.mixin.AliasAccessor, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.PayloadAccessor<T>, org.refcodes.mixin.PayloadAccessor.PayloadBuilder<T,PayloadTransmission<T>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<T>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<T>, org.refcodes.mixin.Schemable<SerialSchema>, PayloadSegment<T>, PayloadTransmission<T>, Segment, Segment.SegmentMixin, Transmission, Transmission.TransmissionMixin
Direct Known Subclasses:
AsciizArraySegment, AsciizSegment, BooleanSegment, ByteSegment, DoubleSegment, EnumSegment, FloatSegment, IntSegment, LongSegment, NumberSegment, ShortSegment

public abstract class AbstractPayloadSegment<T> extends Object implements PayloadSegment<T>, Segment.SegmentMixin
An abstract implementation of a Segment with payload.
See Also:
  • Field Details

    • _payload

      protected T _payload
    • _alias

      protected String _alias
  • Constructor Details

    • AbstractPayloadSegment

      protected AbstractPayloadSegment()
      Empty constructor fur sub-classes.
    • AbstractPayloadSegment

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

      public AbstractPayloadSegment(String aAlias, T aValue)
      Constructs a Segment instance with the given value.
      Parameters:
      aAlias - The alias which identifies the content of this segment.
      aValue - The value (payload) to be contained by the Segment.
  • Method Details

    • setPayload

      public void setPayload(T aValue)
      Specified by:
      setPayload in interface org.refcodes.mixin.PayloadAccessor.PayloadMutator<T>
    • getPayload

      public T getPayload()
      Specified by:
      getPayload in interface org.refcodes.mixin.PayloadAccessor<T>
    • getAlias

      public String getAlias()
      Specified by:
      getAlias in interface org.refcodes.mixin.AliasAccessor
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • 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
      Returns:
      The SimpleTypeMap representing this Transmission and (if any) its children, with the according aliases forming the paths to the Transmission's values.