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
ConstructorsConstructorDescriptionObserverDescriptorImpl(O aEventListener, EM aEventMatcher) Constructs the event listener descriptor with the given event listener and the given event matcher. -
Method Summary
Modifier and TypeMethodDescriptionReturns theEventMatcherassociated with the givenObserver.Returns theObserverassociated with the givenEventMatcher.voidThe 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:
onEventin interfaceObserver<E extends GenericEvent<?>>- Parameters:
aEvent- aEvent The event to be pushed from the publisher to the subscriber.
-
getObserver
Returns theObserverassociated with the givenEventMatcher.- Specified by:
getObserverin interfaceObserverDescriptor<E extends GenericEvent<?>,O extends Observer<E>, EM extends EventMatcher<E>> - Returns:
- The
Observeras it is being managed by theObserverDescriptor.
-
getEventMatcher
Returns theEventMatcherassociated with the givenObserver.- Specified by:
getEventMatcherin interfaceObserverDescriptor<E extends GenericEvent<?>,O extends Observer<E>, EM extends EventMatcher<E>> - Returns:
- The
EventMatcheras it is being managed by theObserverDescriptor.
-