java.lang.Object
technology.sola.engine.event.EventHub
EventHub handles distribution of
Event
s that are emitted to their respective EventListener
s that have
been added.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Event>
voidadd
(Class<T> eventClass, EventListener<T> eventListener) Adds anEventListener
that listens to events of desired type.<T extends Event>
voidemit
(T event) Sends anEvent
to allEventListener
s that have been added for that event type.<T extends Event>
voidRemoves allEventListener
for an event type.<T extends Event>
voidremove
(Class<T> eventClass, EventListener<T> eventListener) Removes anEventListener
that is listening to events of desired type.
-
Constructor Details
-
EventHub
public EventHub()
-
-
Method Details
-
add
Adds anEventListener
that 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 anEventListener
that 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 allEventListener
for 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 anEvent
to allEventListener
s that have been added for that event type.- Type Parameters:
T
- the type of the event- Parameters:
event
- theEvent
to send
-