public interface EventBusObservable<E extends org.refcodes.observer.Event<?>,O extends org.refcodes.observer.Observer<E>,EM extends org.refcodes.observer.EventMatcher<E>,H>
extends org.refcodes.component.HandleLookup<H,O>
Observable
part of the EventBus
provides means to
register Observer
instances.
In case your EventBusObservable
notifies upon events of type
MetaDataEvent
, you may use the MetaDataEventImpl
and an
action for distinguishing your various types of notification:
TIPP: In order to distinguish MetaDataEventImpl
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 and Description |
---|---|
H |
subscribe(O aObserver,
EM aEventMatcher)
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(O aObserver, EM aEventMatcher)
aObserver
- The Observer
to subscribe.aEventMatcher
- The EventMatcher
to guard the
Observer
.void unsubscribeAll(O aObserver)
aObserver
- Copyright © 2016. All rights reserved.