| Modifier | Constructor and Description |
|---|---|
|
EventBus()
Creates this, with a "default" identifier.
|
|
EventBus(com.google.common.base.Function<? super Method,Handler> handlerBuilder,
Executor dispatcher)
Creates this.
|
protected |
EventBus(com.google.common.base.Predicate<? super Method> isHandler,
com.google.common.base.Function<? super Method,Handler> handlerBuilder,
Executor dispatcher)
Creates this.
|
|
EventBus(String identifier)
Creates this.
|
|
EventBus(String identifier,
boolean batchDispatching,
Executor handlerExecutor,
Executor dispatcher)
Creates this.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
dispatch(Object event)
Dispatches an event.
|
protected Set<Handler> |
newHandlerSet()
Provides a new empty set for handlers.
|
void |
post(Object event)
Posts an event to all registered handlers.
|
void |
register(Object target)
Registers all handler methods on
object to receive events. |
void |
registerWeak(Object target)
Registers all handler methods on
object to receive events, but only keeps a weak reference to the
object. |
void |
run() |
void |
unregister(Object target)
Unregisters all handler methods on a registered
object. |
public EventBus()
public EventBus(String identifier)
identifier - the bus identifierpublic EventBus(String identifier, boolean batchDispatching, Executor handlerExecutor, Executor dispatcher)
identifier - the bus identifierbatchDispatching - if true, event processing is batched (same thread per handler/event)handlerExecutor - the executor which will performs the handler callbacksdispatcher - the executor which will perform the dispatchingpublic EventBus(com.google.common.base.Function<? super Method,Handler> handlerBuilder, Executor dispatcher)
handlerBuilder - the factory for handlersdispatcher - the executor which will perform the dispatchingprotected EventBus(com.google.common.base.Predicate<? super Method> isHandler, com.google.common.base.Function<? super Method,Handler> handlerBuilder, Executor dispatcher)
isHandler - determines if a method is a handlerhandlerBuilder - the factory for handlersdispatcher - the executor which will perform the dispatchingprotected Set<Handler> newHandlerSet()
protected void dispatch(Object event)
event - the eventpublic void post(Object event)
event - event to post.public void register(Object target)
object to receive events.object - object whose handler methods should be registered.public void registerWeak(Object target)
object to receive events, but only keeps a weak reference to the
object.object - object whose handler methods should be registered.public void unregister(Object target)
object.object - object whose handler methods should be unregistered.Copyright © 2013. All Rights Reserved.