E
- the element typeO
- the generic typeMATCH
- the generic typeH
- the generic typeorg.refcodes.component.HandleLookup<H,O>
EventBus
, GenericEventBus<E,O,MATCH,META,H>
AbstractEventBus
, EventBusImpl
public interface GenericBusObservable<E extends org.refcodes.observer.GenericEvent<?>,O extends org.refcodes.observer.Observer<E>,MATCH extends org.refcodes.observer.EventMatcher<E>,H>
extends org.refcodes.component.HandleLookup<H,O>
Observable
part of the GenericEventBus
provides means to
register Observer
instances.
In case your GenericBusObservable
notifies upon events of type
ActionMetaDataEvent
, you may use the ActionMetaDataEventImpl
and an action for distinguishing your various types of notification:
TIPP: In order to distinguish ActionMetaDataEventImpl
instances from
each other, create an actions enumeration, enumerating the various event
actions you support. Pass the actual action you intend to notify upon to the
according constructor, as an Observer
you may use the declarative
method EventMatcherSugar.actionEqualWith(Object)
to test whether your
action was notified (or a simple switch case statement).
Modifier and Type | Method | Description |
---|---|---|
<EVT extends E> |
subscribe(Class<EVT> aEventType,
MATCH aEventMatcher,
org.refcodes.observer.Observer<EVT> aObserver) |
Subscribes a listener to the event bus.
|
<EVT extends E> |
subscribe(Class<EVT> aEventType,
org.refcodes.observer.Observer<EVT> aObserver) |
Subscribes a listener to the event bus.
|
H |
subscribe(MATCH aEventMatcher,
O aObserver) |
Subscribes a listener to the event bus.
|
void |
unsubscribeAll(O aObserver) |
Unsubscribes all registrations to a specific listener, even if that
listener is involved in several subscriptions.
|
H subscribe(MATCH aEventMatcher, O aObserver)
aEventMatcher
- The EventMatcher
to guard the
Observer
.aObserver
- The Observer
to subscribe.<EVT extends E> H subscribe(Class<EVT> aEventType, org.refcodes.observer.Observer<EVT> aObserver)
EVT
- The type of the event to subscribe for.aEventType
- The type of event to observe.aObserver
- The Observer
to subscribe.<EVT extends E> H subscribe(Class<EVT> aEventType, MATCH aEventMatcher, org.refcodes.observer.Observer<EVT> aObserver)
EVT
- The type of the event to subscribe for.aEventType
- The type of event to observe.aEventMatcher
- The EventMatcher
to guard the
Observer
.aObserver
- The Observer
to subscribe.void unsubscribeAll(O aObserver)
aObserver
- the observerCopyright © 2018. All rights reserved.