E
- the element typeO
- the generic typeEM
- the generic typeH
- the generic typepublic abstract class AbstractEventBus<E extends org.refcodes.observer.Event<?>,O extends org.refcodes.observer.Observer<E>,EM extends org.refcodes.observer.EventMatcher<E>,H> extends Object implements EventBusObservable<E,O,EM,H>, EventBusPublisher<E>
Constructor and Description |
---|
AbstractEventBus(org.refcodes.component.HandleGenerator<H> aHandleGenerator)
Constructs the subscribe event bus with the given handle generator.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasHandle(H aHandle) |
boolean |
isMatching(E aEvent) |
O |
lookupHandle(H aHandle) |
void |
publishEvent(E aEvent) |
O |
removeHandle(H aHandle) |
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.
|
public AbstractEventBus(org.refcodes.component.HandleGenerator<H> aHandleGenerator)
aHandleGenerator
- The handle generator to be used.public void publishEvent(E aEvent)
publishEvent
in interface org.refcodes.observer.Publisher<E extends org.refcodes.observer.Event<?>>
public boolean isMatching(E aEvent)
public H subscribe(O aObserver, EM aEventMatcher)
subscribe
in interface EventBusObservable<E extends org.refcodes.observer.Event<?>,O extends org.refcodes.observer.Observer<E>,EM extends org.refcodes.observer.EventMatcher<E>,H>
aObserver
- The Observer
to subscribe.aEventMatcher
- The EventMatcher
to guard the
Observer
.public void unsubscribeAll(O aObserver)
unsubscribeAll
in interface EventBusObservable<E extends org.refcodes.observer.Event<?>,O extends org.refcodes.observer.Observer<E>,EM extends org.refcodes.observer.EventMatcher<E>,H>
aObserver
- the a observerpublic boolean hasHandle(H aHandle)
public O lookupHandle(H aHandle) throws org.refcodes.component.UnknownHandleRuntimeException
Copyright © 2017. All rights reserved.