java.lang.Object
technology.sola.engine.event.EventHub
EventHub handles distribution of
Events that are emitted to their respective EventListeners that have
been added.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Event>
voidadd(Class<T> eventClass, EventListener<T> eventListener) Adds anEventListenerthat listens to events of desired type.<T extends Event>
voidemit(T event) Sends anEventto allEventListeners that have been added for that event type.<T extends Event>
voidRemoves allEventListenerfor an event type.<T extends Event>
voidremove(Class<T> eventClass, EventListener<T> eventListener) Removes anEventListenerthat is listening to events of desired type.
-
Constructor Details
-
EventHub
public EventHub()
-
-
Method Details
-
add
Adds anEventListenerthat listens to events of desired type.- Type Parameters:
T- the type of the event- Parameters:
eventClass- the class of the type of events to listen toeventListener- theEventListener
-
remove
Removes anEventListenerthat is listening to events of desired type.- Type Parameters:
T- the type of the event- Parameters:
eventClass- the class of the type of events to remove a listener fromeventListener- theEventListener
-
off
Removes allEventListenerfor an event type.- Type Parameters:
T- the type of the event- Parameters:
eventClass- the class of the type of events to remove a listener from
-
emit
Sends anEventto allEventListeners that have been added for that event type.- Type Parameters:
T- the type of the event- Parameters:
event- theEventto send
-