public interface IEventManager
Modifier and Type | Interface and Description |
---|---|
static interface |
IEventManager.IListener<TEventData>
Represents the base type for all event consumers
|
Modifier and Type | Method and Description |
---|---|
<TEventData> |
notify(Class<TEventData> eventClass)
Calls all existing listeners of the given type of event.
|
<TEventData> |
notify(TEventData event)
Calls all existing listeners of the given type of event
|
<TEventData> |
notifyAnyway(Class<TEventData> eventClass)
Calls all listeners of the given type of event.
|
<TEventData> |
notifyAnyway(TEventData event)
Calls all listeners of the given type of event.
|
<TEventData> |
subscribe(Class<TEventData> eventType,
IEventManager.IListener<TEventData> listener)
Adds a listener into the storage
|
<TEventData> |
subscribe(Class<TEventData> eventType,
Runnable listener)
Adds a listener (that doesn't accept any data) to the storage (for the events without data)
|
<TEventData> |
unsubscribe(Class<TEventData> eventType,
IEventManager.IListener<TEventData> listener)
Removes the listener from the storage
|
<TEventData> boolean subscribe(Class<TEventData> eventType, IEventManager.IListener<TEventData> listener)
TEventData
- the type of desired eventeventType
- the type of the desired eventlistener
- the consumer of desired event. The consumer will be called with an instance of eventTypetrue
in the case of successful subscription<TEventData> boolean subscribe(Class<TEventData> eventType, Runnable listener)
TEventData
- the type of the desired eventeventType
- the type of the desired eventlistener
- the consumer of desired event. The consumer will be called with an instance of eventTypetrue
in the case of successful subscription<TEventData> boolean unsubscribe(Class<TEventData> eventType, IEventManager.IListener<TEventData> listener)
TEventData
- the type of the desired eventeventType
- the type of the event to unsubscribe fromlistener
- the consumer to be removedtrue
in the case of successful unsubscription<TEventData> long notify(TEventData event)
TEventData
- the type of the desired eventevent
- an instance of the desired event. This instance is used as a parameter for all listeners<TEventData> long notify(Class<TEventData> eventClass)
null
as eventData
in order not to create empty instances of eventsTEventData
- the type of the desired eventeventClass
- the type of the desired event. All listeners get null
as parameter<TEventData> long notifyAnyway(TEventData event)
TEventData
- the type of the desired eventevent
- an instance of the desired event. All listeners get this instance as parameter<TEventData> long notifyAnyway(Class<TEventData> eventClass)
The listeners get null
as eventData in order not to create empty instances of events
TEventData
- the type of the desired eventeventClass
- the desired type of event. All listeners get null
as parameterCopyright © 2024. All rights reserved.