Module org.refcodes.observer
Package org.refcodes.observer
Class ObserverDescriptor<E extends Event<?>,O extends Observer<E>,EM extends EventMatcher<E>>
java.lang.Object
org.refcodes.observer.ObserverDescriptor<E,O,EM>
- Type Parameters:
E- the element typeO- the generic typeEM- the generic type
- All Implemented Interfaces:
Observer<E>
public class ObserverDescriptor<E extends Event<?>,O extends Observer<E>,EM extends EventMatcher<E>>
extends Object
implements Observer<E>
This
ObserverDescriptor describes the Observer, i.e. in some
cases an Observer requires an EventMatcher which determines
which ActionEvent instances to pass to the Observer. The
ObserverDescriptor is itself an Observer calling the
EventMatcher to determine whether to delegate the ActionEvent
to contained Observer or not.-
Constructor Summary
ConstructorsConstructorDescriptionObserverDescriptor(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
-
ObserverDescriptor
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. -
getObserver
Returns theObserverassociated with the givenEventMatcher.- Returns:
- The
Observeras it is being managed by theObserverDescriptor.
-
getEventMatcher
Returns theEventMatcherassociated with the givenObserver.- Returns:
- The
EventMatcheras it is being managed by theObserverDescriptor.
-