Package org.refcodes.serial.ext.observer
Class ObservableSectionDecorator<DECORATEE extends org.refcodes.serial.Section>
- java.lang.Object
-
- org.refcodes.serial.ext.observer.ObservableSectionDecorator<DECORATEE>
-
- Type Parameters:
DECORATEE
- The type of the observed decoratee in question.
- All Implemented Interfaces:
Serializable
,org.refcodes.mixin.DecorateeAccessor<DECORATEE>
,org.refcodes.mixin.LengthAccessor
,org.refcodes.observer.Observable<TransmissionObserver<DECORATEE>>
,org.refcodes.serial.DecoratorSection<DECORATEE>
,ObservableSection<DECORATEE>
,ObservableTransmission<DECORATEE>
,org.refcodes.serial.Section
,org.refcodes.serial.Transmission
public class ObservableSectionDecorator<DECORATEE extends org.refcodes.serial.Section> extends Object implements ObservableSection<DECORATEE>, org.refcodes.serial.DecoratorSection<DECORATEE>
TheObservableSection
class enriches aSection
decoratee with observer functionality as of theObservableSection
interface. In case the decoratee was updated as ofreceiveFrom(InputStream, int, OutputStream)
orfromTransmission(Sequence, int, int)
or the like, aTransmissionEvent
is fired.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested 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.LengthProperty
-
-
Constructor Summary
Constructors Constructor Description ObservableSectionDecorator(DECORATEE aDecoratee)
Constructs aObservableSection
wrapping the givenSection
decoratee and using a defaultExecutorService
and dispatching events in sequentially (as ofExecutionStrategy.SEQUENTIAL
).ObservableSectionDecorator(DECORATEE aDecoratee, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableSection
wrapping the givenSection
decoratee and using the providedExecutorService
when dispatching events in parallel (as ofExecutionStrategy.PARALLEL
andExecutionStrategy.JOIN
) and using the givenExecutionStrategy
when dispatching the events.ObservableSectionDecorator(DECORATEE aDecoratee, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableSection
wrapping the givenSection
decoratee and using the providedExecutionStrategy
when dispatching the events.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fromTransmission(org.refcodes.serial.Sequence aSequence, int aOffset, int aLength)
DECORATEE
getDecoratee()
int
getLength()
boolean
hasObserverSubscription(TransmissionObserver<DECORATEE> aObserver)
void
receiveFrom(InputStream aInputStream, int aLength, OutputStream aReturnStream)
boolean
subscribeObserver(TransmissionObserver<DECORATEE> aObserver)
org.refcodes.serial.Schema
toSchema()
org.refcodes.struct.SimpleTypeMap
toSimpleTypeMap()
org.refcodes.serial.Sequence
toTransmission()
void
transmitTo(OutputStream aOutputStream, InputStream aReturnStream)
boolean
unsubscribeObserver(TransmissionObserver<DECORATEE> aObserver)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
ObservableSectionDecorator
public ObservableSectionDecorator(DECORATEE aDecoratee)
Constructs aObservableSection
wrapping the givenSection
decoratee and using a defaultExecutorService
and dispatching events in sequentially (as ofExecutionStrategy.SEQUENTIAL
).- Parameters:
aDecoratee
- The decoratee to be wrapped by the observable decorator.
-
ObservableSectionDecorator
public ObservableSectionDecorator(DECORATEE aDecoratee, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableSection
wrapping the givenSection
decoratee and using the providedExecutionStrategy
when dispatching the events.- Parameters:
aDecoratee
- The decoratee to be wrapped by the observable decorator.aExecutionStrategy
- the execution strategy to use when dispatching events.
-
ObservableSectionDecorator
public ObservableSectionDecorator(DECORATEE aDecoratee, ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableSection
wrapping the givenSection
decoratee and using the providedExecutorService
when dispatching events in parallel (as ofExecutionStrategy.PARALLEL
andExecutionStrategy.JOIN
) and using the givenExecutionStrategy
when 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 Detail
-
fromTransmission
public void fromTransmission(org.refcodes.serial.Sequence aSequence, int aOffset, int aLength) throws org.refcodes.serial.TransmissionException
- Specified by:
fromTransmission
in interfaceorg.refcodes.serial.Section
- Throws:
org.refcodes.serial.TransmissionException
-
receiveFrom
public void receiveFrom(InputStream aInputStream, int aLength, OutputStream aReturnStream) throws IOException, org.refcodes.serial.TransmissionException
- Specified by:
receiveFrom
in interfaceorg.refcodes.serial.Section
- Throws:
IOException
org.refcodes.serial.TransmissionException
-
getLength
public int getLength()
- Specified by:
getLength
in interfaceorg.refcodes.mixin.LengthAccessor
- Specified by:
getLength
in interfaceorg.refcodes.serial.Transmission
-
toTransmission
public org.refcodes.serial.Sequence toTransmission()
- Specified by:
toTransmission
in interfaceorg.refcodes.serial.Transmission
-
transmitTo
public void transmitTo(OutputStream aOutputStream, InputStream aReturnStream) throws IOException
- Specified by:
transmitTo
in interfaceorg.refcodes.serial.Transmission
- Throws:
IOException
-
toSchema
public org.refcodes.serial.Schema toSchema()
- Specified by:
toSchema
in interfaceorg.refcodes.serial.Transmission
-
toSimpleTypeMap
public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()
- Specified by:
toSimpleTypeMap
in interfaceorg.refcodes.serial.Transmission
-
getDecoratee
public DECORATEE getDecoratee()
- Specified by:
getDecoratee
in interfaceorg.refcodes.mixin.DecorateeAccessor<DECORATEE extends org.refcodes.serial.Section>
-
hasObserverSubscription
public boolean hasObserverSubscription(TransmissionObserver<DECORATEE> aObserver)
- Specified by:
hasObserverSubscription
in interfaceorg.refcodes.observer.Observable<DECORATEE extends org.refcodes.serial.Section>
-
subscribeObserver
public boolean subscribeObserver(TransmissionObserver<DECORATEE> aObserver)
- Specified by:
subscribeObserver
in interfaceorg.refcodes.observer.Observable<DECORATEE extends org.refcodes.serial.Section>
-
unsubscribeObserver
public boolean unsubscribeObserver(TransmissionObserver<DECORATEE> aObserver)
- Specified by:
unsubscribeObserver
in interfaceorg.refcodes.observer.Observable<DECORATEE extends org.refcodes.serial.Section>
-
-