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.Resetable,org.refcodes.schema.Schemable,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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.AliasAccessor
org.refcodes.mixin.AliasAccessor.AliasBuilder<B extends org.refcodes.mixin.AliasAccessor.AliasBuilder<B>>, org.refcodes.mixin.AliasAccessor.AliasMutator, org.refcodes.mixin.AliasAccessor.AliasPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.LengthAccessor
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.PayloadAccessor
org.refcodes.mixin.PayloadAccessor.PayloadBuilder<P extends Object,B extends org.refcodes.mixin.PayloadAccessor.PayloadBuilder<P, B>>, org.refcodes.mixin.PayloadAccessor.PayloadMutator<P extends Object>, org.refcodes.mixin.PayloadAccessor.PayloadProperty<P extends Object> Nested classes/interfaces inherited from interface org.refcodes.serial.Segment
Segment.SegmentMixinNested classes/interfaces inherited from interface org.refcodes.serial.Transmission
Transmission.TransmissionMixin -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructor fur sub-classes.AbstractPayloadSegment(String aAlias) Constructs an emptySegmentto be initialized viaSegment.fromTransmission(Sequence)orSegment.fromTransmission(Sequence, int).AbstractPayloadSegment(String aAlias, T aValue) Constructs aSegmentinstance with the given value. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAlias()inthashCode()voidreset()Resets any dynamic data (e.g. values such as payloads or checksums) and must not(!)voidsetPayload(T aValue) org.refcodes.struct.SimpleTypeMapReturns theSimpleTypeMaprepresentation of thisTransmission.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.mixin.PayloadAccessor
getPayloadOrMethods inherited from interface org.refcodes.mixin.PayloadAccessor.PayloadBuilder
withPayloadMethods inherited from interface org.refcodes.mixin.PayloadAccessor.PayloadProperty
letPayloadMethods inherited from interface org.refcodes.serial.Segment
fromTransmission, fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFromMethods inherited from interface org.refcodes.serial.Segment.SegmentMixin
receiveFromMethods inherited from interface org.refcodes.serial.Transmission
getLength, toSchema, toSequence, transmitTo, transmitToMethods inherited from interface org.refcodes.serial.Transmission.TransmissionMixin
transmitTo
-
Field Details
-
_payload
-
_alias
-
-
Constructor Details
-
AbstractPayloadSegment
protected AbstractPayloadSegment()Empty constructor fur sub-classes. -
AbstractPayloadSegment
Constructs an emptySegmentto be initialized viaSegment.fromTransmission(Sequence)orSegment.fromTransmission(Sequence, int).- Parameters:
aAlias- The alias which identifies the content of this segment.
-
AbstractPayloadSegment
Constructs aSegmentinstance with the given value.- Parameters:
aAlias- The alias which identifies the content of this segment.aValue- The value (payload) to be contained by theSegment.
-
-
Method Details
-
setPayload
- Specified by:
setPayloadin interfaceorg.refcodes.mixin.PayloadAccessor.PayloadMutator<T>
-
getPayload
- Specified by:
getPayloadin interfaceorg.refcodes.mixin.PayloadAccessor<T>
-
getAlias
- Specified by:
getAliasin interfaceorg.refcodes.mixin.AliasAccessor
-
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. theTransmissionMetrics).- Specified by:
resetin interfaceorg.refcodes.mixin.Resetable- Specified by:
resetin interfaceTransmission
-
toString
-
hashCode
public int hashCode() -
equals
-
toSimpleTypeMap
public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()Returns theSimpleTypeMaprepresentation of thisTransmission. In case this Transmission hasTransmissionchildren, then the children are queried as well and contained in the resultingSimpleTypeMap. The aliases of the accordingTransmissioninstances represent the resulting path to aTransmission's final simple type.- Specified by:
toSimpleTypeMapin interfaceTransmission- Returns:
- The
SimpleTypeMaprepresenting thisTransmissionand (if any) its children, with the according aliases forming the paths to theTransmission's values.
-