Module org.refcodes.observer
Package org.refcodes.observer
Class ObserverDescriptorImpl<E extends GenericEvent<?>,O extends Observer<E>,EM extends EventMatcher<E>>
java.lang.Object
org.refcodes.observer.ObserverDescriptorImpl<E,O,EM>
- Type Parameters:
E
- The event type.O
- the generic typeEM
- the generic type
- All Implemented Interfaces:
Observer<E>
,ObserverDescriptor<E,
O, EM>
public class ObserverDescriptorImpl<E extends GenericEvent<?>,O extends Observer<E>,EM extends EventMatcher<E>>
extends Object
implements ObserverDescriptor<E,O,EM>
As a descriptor describes something fixed, this class is immutable in the
sense that there are no setters for the attributes. The attributes must be
provided via the constructor.
-
Constructor Summary
ConstructorDescriptionObserverDescriptorImpl
(O aEventListener, EM aEventMatcher) Constructs the event listener descriptor with the given event listener and the given event matcher. -
Method Summary
Modifier and TypeMethodDescriptionReturns theEventMatcher
associated with the givenObserver
.Returns theObserver
associated with the givenEventMatcher
.void
The listener implementing this interface is notified of an event via this method.
-
Constructor Details
-
ObserverDescriptorImpl
Constructs the event listener descriptor with the given event listener and the given event matcher.- Parameters:
aEventListener
- The listener to be stored in the event listener descriptor.aEventMatcher
- The matcher to be stored in the event listener descriptor.
-
-
Method Details
-
onEvent
The listener implementing this interface is notified of an event via this method. The publisher pushes the event to the subscriber.- Specified by:
onEvent
in interfaceObserver<E extends GenericEvent<?>>
- Parameters:
aEvent
- aEvent The event to be pushed from the publisher to the subscriber.
-
getObserver
Returns theObserver
associated with the givenEventMatcher
.- Specified by:
getObserver
in interfaceObserverDescriptor<E extends GenericEvent<?>,
O extends Observer<E>, EM extends EventMatcher<E>> - Returns:
- The
Observer
as it is being managed by theObserverDescriptor
.
-
getEventMatcher
Returns theEventMatcher
associated with the givenObserver
.- Specified by:
getEventMatcher
in interfaceObserverDescriptor<E extends GenericEvent<?>,
O extends Observer<E>, EM extends EventMatcher<E>> - Returns:
- The
EventMatcher
as it is being managed by theObserverDescriptor
.
-