Package org.refcodes.serial.ext.observer
Class ObservablePayloadSectionDecorator<T>
java.lang.Object
org.refcodes.serial.ext.observer.ObservablePayloadSectionDecorator<T>
- Type Parameters:
T- The type of the payload.
- All Implemented Interfaces:
Serializable,org.refcodes.mixin.AliasAccessor,org.refcodes.mixin.DecorateeAccessor<org.refcodes.serial.PayloadSection<T>>,org.refcodes.mixin.LengthAccessor,org.refcodes.mixin.PayloadAccessor<T>,org.refcodes.mixin.PayloadAccessor.PayloadBuilder<T,,org.refcodes.serial.PayloadTransmission<T>> org.refcodes.mixin.PayloadAccessor.PayloadMutator<T>,org.refcodes.mixin.PayloadAccessor.PayloadProperty<T>,org.refcodes.mixin.Schemable<org.refcodes.serial.SerialSchema>,org.refcodes.observer.Observable<PayloadObserver<T>>,org.refcodes.serial.DecoratorSection<org.refcodes.serial.PayloadSection<T>>,ObservablePayloadSection<T>,ObservablePayloadTransmission<T>,org.refcodes.serial.PayloadSection<T>,org.refcodes.serial.PayloadTransmission<T>,org.refcodes.serial.Section,org.refcodes.serial.Transmission
public class ObservablePayloadSectionDecorator<T>
extends Object
implements ObservablePayloadSection<T>, org.refcodes.serial.DecoratorSection<org.refcodes.serial.PayloadSection<T>>
The
ObservablePayloadSection class enriches a PayloadSection
decoratee with observer functionality as of the
ObservablePayloadSection interface. In case the decoratee was updated
as of receiveFrom(InputStream, int, OutputStream) or
Section.fromTransmission(Sequence, int) or the like, a PayloadEvent
is fired. Attention: It is not fired upon calling
setPayload(Object)!- 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.DecorateeAccessor
org.refcodes.mixin.DecorateeAccessor.DecorateeBuilder<DECORATEE extends Object,B extends org.refcodes.mixin.DecorateeAccessor.DecorateeBuilder<DECORATEE, B>>, org.refcodes.mixin.DecorateeAccessor.DecorateeMutator<DECORATEE extends Object>, org.refcodes.mixin.DecorateeAccessor.DecorateeProperty<DECORATEE extends Object> Nested 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.Section
org.refcodes.serial.Section.SectionMixinNested classes/interfaces inherited from interface org.refcodes.serial.Transmission
org.refcodes.serial.Transmission.TransmissionMixin -
Constructor Summary
ConstructorsConstructorDescriptionObservablePayloadSectionDecorator(org.refcodes.serial.PayloadSection<T> aDecoratee) Constructs aObservablePayloadSectionwrapping the givenPayloadSectiondecoratee and using a defaultExecutorServiceand dispatching events in sequentially (as ofExecutionStrategy.SEQUENTIAL).ObservablePayloadSectionDecorator(org.refcodes.serial.PayloadSection<T> aDecoratee, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservablePayloadSectionwrapping the givenPayloadSectiondecoratee and using the providedExecutorServicewhen dispatching events in parallel (as ofExecutionStrategy.PARALLELandExecutionStrategy.JOIN) and using the givenExecutionStrategywhen dispatching the events.ObservablePayloadSectionDecorator(org.refcodes.serial.PayloadSection<T> aDecoratee, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservablePayloadSectionwrapping the givenPayloadSectiondecoratee and using the providedExecutionStrategywhen dispatching the events. -
Method Summary
Modifier and TypeMethodDescriptionvoidfromTransmission(org.refcodes.serial.Sequence aSequence, int aOffset, int aLength) getAlias()org.refcodes.serial.PayloadSection<T>intbooleanhasObserverSubscription(PayloadObserver<T> aObserver) voidreceiveFrom(InputStream aInputStream, int aOffset, OutputStream aReturnStream) voidsetPayload(T aValue) booleansubscribeObserver(PayloadObserver<T> aObserver) org.refcodes.serial.SerialSchematoSchema()org.refcodes.serial.Sequenceorg.refcodes.struct.SimpleTypeMapvoidtransmitTo(OutputStream aOutputStream, InputStream aReturnStream) booleanunsubscribeObserver(PayloadObserver<T> aObserver) org.refcodes.serial.PayloadTransmission<T>withPayload(T aValue) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.mixin.PayloadAccessor
getPayloadOrMethods inherited from interface org.refcodes.mixin.PayloadAccessor.PayloadProperty
letPayloadMethods inherited from interface org.refcodes.serial.Section
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFromMethods inherited from interface org.refcodes.serial.Transmission
transmitTo, transmitTo
-
Constructor Details
-
ObservablePayloadSectionDecorator
Constructs aObservablePayloadSectionwrapping the givenPayloadSectiondecoratee and using a defaultExecutorServiceand dispatching events in sequentially (as ofExecutionStrategy.SEQUENTIAL).- Parameters:
aDecoratee- The decoratee to be wrapped by the observable decorator.
-
ObservablePayloadSectionDecorator
public ObservablePayloadSectionDecorator(org.refcodes.serial.PayloadSection<T> aDecoratee, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservablePayloadSectionwrapping the givenPayloadSectiondecoratee and using the providedExecutionStrategywhen dispatching the events.- Parameters:
aDecoratee- The decoratee to be wrapped by the observable decorator.aExecutionStrategy- the execution strategy to use when dispatching events.
-
ObservablePayloadSectionDecorator
public ObservablePayloadSectionDecorator(org.refcodes.serial.PayloadSection<T> aDecoratee, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy) Constructs aObservablePayloadSectionwrapping the givenPayloadSectiondecoratee and using the providedExecutorServicewhen dispatching events in parallel (as ofExecutionStrategy.PARALLELandExecutionStrategy.JOIN) and using the givenExecutionStrategywhen dispatching the events.- Parameters:
aDecoratee- The decoratee to be wrapped by the observable decorator.aExecutorService- the executor service to use when dispatching events.aExecutionStrategy- the execution strategy to use when dispatching events.
-
-
Method Details
-
fromTransmission
public void fromTransmission(org.refcodes.serial.Sequence aSequence, int aOffset, int aLength) throws org.refcodes.serial.TransmissionException - Specified by:
fromTransmissionin interfaceorg.refcodes.serial.Section- Throws:
org.refcodes.serial.TransmissionException
-
receiveFrom
public void receiveFrom(InputStream aInputStream, int aOffset, OutputStream aReturnStream) throws IOException, org.refcodes.serial.TransmissionException - Specified by:
receiveFromin interfaceorg.refcodes.serial.Section- Throws:
IOExceptionorg.refcodes.serial.TransmissionException
-
getLength
public int getLength()- Specified by:
getLengthin interfaceorg.refcodes.mixin.LengthAccessor- Specified by:
getLengthin interfaceorg.refcodes.serial.Transmission
-
toSequence
public org.refcodes.serial.Sequence toSequence()- Specified by:
toSequencein interfaceorg.refcodes.serial.Transmission
-
transmitTo
- Specified by:
transmitToin interfaceorg.refcodes.serial.Transmission- Throws:
IOException
-
toSchema
public org.refcodes.serial.SerialSchema toSchema()- Specified by:
toSchemain interfaceorg.refcodes.mixin.Schemable<T>- Specified by:
toSchemain interfaceorg.refcodes.serial.Transmission
-
toSimpleTypeMap
public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()- Specified by:
toSimpleTypeMapin interfaceorg.refcodes.serial.Transmission
-
withPayload
-
getPayload
- Specified by:
getPayloadin interfaceorg.refcodes.mixin.PayloadAccessor<T>
-
setPayload
- Specified by:
setPayloadin interfaceorg.refcodes.mixin.PayloadAccessor.PayloadMutator<T>
-
getDecoratee
- Specified by:
getDecorateein interfaceorg.refcodes.mixin.DecorateeAccessor<T>
-
getAlias
- Specified by:
getAliasin interfaceorg.refcodes.mixin.AliasAccessor
-
hasObserverSubscription
- Specified by:
hasObserverSubscriptionin interfaceorg.refcodes.observer.Observable<T>
-
subscribeObserver
- Specified by:
subscribeObserverin interfaceorg.refcodes.observer.Observable<T>
-
unsubscribeObserver
- Specified by:
unsubscribeObserverin interfaceorg.refcodes.observer.Observable<T>
-