|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.baka.ambient.commons.SimpleBus
public final class SimpleBus
A simple message delivery bus. All events are invoked asynchronously in the message loop.
Constructor Summary | |
---|---|
SimpleBus()
|
Method Summary | ||
---|---|---|
void |
addHandler(Object handler)
Registers this handler. |
|
void |
addHandler(Object handler,
Class<?> messageType)
Registers given handler only to given message type. |
|
void |
clear()
Removes all handlers and cleans up the object. |
|
|
getInvocator(Class<T> messageType,
boolean async)
Returns an event invocator. |
|
void |
removeHandler(Object handler)
Unregisters this handler. |
|
void |
removeHandler(Object handler,
Class<?> messageType)
Unregisters given handler only to given message type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleBus()
Method Detail |
---|
public void addHandler(Object handler)
addHandler(Object, Class)
.
handler
- the handler to register.public void addHandler(Object handler, Class<?> messageType)
messageType
interface otherwise
ClassCastException
is thrown.
messageType
- the message interfacehandler
- handler that implements given interface.public void removeHandler(Object handler)
removeHandler(Object, Class)
.
handler
- the handler to unregister.public void removeHandler(Object handler, Class<?> messageType)
messageType
interface otherwise
ClassCastException
is thrown.
messageType
- the message interfacehandler
- handler that implements given interface.public <T> T getInvocator(Class<T> messageType, boolean async)
T
- the interface typemessageType
- the interface classasync
- if true
then the invocation is dispatched using
a Handler. If false
then the invocation is
forced immediately. In this case, the invocator methods
should be called in the handler event
thread.
null
.public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |