public class AnnotationEventListenerAdapter extends Object implements Subscribable, EventListenerProxy, ReplayAware
EventHandler
annotated methods into an EventListener
.EventListener
Constructor and Description |
---|
AnnotationEventListenerAdapter(Object annotatedEventListener,
EventBus eventBus)
Initialize the AnnotationEventListenerAdapter for the given
annotatedEventListener . |
Modifier and Type | Method and Description |
---|---|
void |
afterReplay()
Invoked when a replay has finished.
|
void |
beforeReplay()
Invoked when a replay is started.
|
Class<?> |
getTargetType()
Returns the instance type that this proxy delegates all event handling to.
|
void |
handle(EventMessage event)
Process the given event.
|
void |
subscribe()
Subscribe the EventListener with the configured EventBus.
|
static AnnotationEventListenerAdapter |
subscribe(Object annotatedEventListener,
EventBus eventBus)
Subscribe the given
annotatedEventListener to the given eventBus . |
void |
unsubscribe()
Unsubscribe the EventListener with the configured EventBus.
|
public AnnotationEventListenerAdapter(Object annotatedEventListener, EventBus eventBus)
annotatedEventListener
. When the
adapter
subscribes, it will subscribe to the given event bus.annotatedEventListener
- the event listenereventBus
- the event bus to register the event listener topublic static AnnotationEventListenerAdapter subscribe(Object annotatedEventListener, EventBus eventBus)
annotatedEventListener
to the given eventBus
.annotatedEventListener
- The annotated event listenereventBus
- The event bus to subscribe topublic void handle(EventMessage event)
handle
in interface EventListener
event
- the event to handle@PreDestroy public void unsubscribe()
unsubscribe
in interface Subscribable
@PostConstruct public void subscribe()
subscribe
in interface Subscribable
public Class<?> getTargetType()
EventListenerProxy
getTargetType
in interface EventListenerProxy
public void beforeReplay()
ReplayAware
beforeReplay
in interface ReplayAware
public void afterReplay()
ReplayAware
afterReplay
in interface ReplayAware
Copyright © 2010-2013. All Rights Reserved.