public interface EventPublisher
| Modifier and Type | Method and Description |
|---|---|
<E extends Event> |
addEventListener(Class<E> eventClass,
CallableWithArgs<?> listener)
Adds a callable as an event listener.
|
void |
addEventListener(Map<String,CallableWithArgs<?>> listener)
Adds a Map containing event listeners.
|
void |
addEventListener(Object listener)
Adds an event listener.
|
void |
addEventListener(String eventName,
CallableWithArgs<?> listener)
Adds a callable as an event listener.
|
boolean |
isEventPublishingEnabled()
Returns whether events will be published by the event bus or not.
|
void |
publishEvent(Event event)
Publishes an event.
|
void |
publishEvent(String eventName)
Publishes an event.
|
void |
publishEvent(String eventName,
List<?> args)
Publishes an event.
|
void |
publishEventAsync(Event event)
Publishes an event.
|
void |
publishEventAsync(String eventName)
Publishes an event.
|
void |
publishEventAsync(String eventName,
List<?> args)
Publishes an event.
|
void |
publishEventOutsideUI(Event event)
Publishes an event.
|
void |
publishEventOutsideUI(String eventName)
Publishes an event.
|
void |
publishEventOutsideUI(String eventName,
List<?> args)
Publishes an event.
|
<E extends Event> |
removeEventListener(Class<E> eventClass,
CallableWithArgs<?> listener)
Removes a callable as an event listener.
|
void |
removeEventListener(Map<String,CallableWithArgs<?>> listener)
Removes a Map containing event listeners.
|
void |
removeEventListener(Object listener)
Removes an event listener.
|
void |
removeEventListener(String eventName,
CallableWithArgs<?> listener)
Removes a callable as an event listener.
|
void |
setEventPublishingEnabled(boolean enabled)
Sets the enabled state for event publishing.
|
void addEventListener(@Nonnull Object listener)
Accepted types are: Script, Map and Object.
listener - an event listenervoid addEventListener(@Nonnull String eventName, @Nonnull CallableWithArgs<?> listener)
eventName - the name of the eventlistener - an event listenervoid addEventListener(@Nonnull Map<String,CallableWithArgs<?>> listener)
An event listener may be a
Some examples of eventHandler names are: StartupStart, MyCoolEvent. Event names must follow the camelCase naming convention.
listener - an event listener of type Map<E extends Event> void addEventListener(@Nonnull Class<E> eventClass, @Nonnull CallableWithArgs<?> listener)
eventClass - the type of the eventlistener - an event listenervoid removeEventListener(@Nonnull Object listener)
Accepted types are: Script, Map and Object.
listener - an event listenervoid removeEventListener(@Nonnull String eventName, @Nonnull CallableWithArgs<?> listener)
eventName - the name of the eventlistener - an event listenervoid removeEventListener(@Nonnull Map<String,CallableWithArgs<?>> listener)
An event listener may be a
Some examples of eventHandler names are: StartupStart, MyCoolEvent. Event names must follow the camelCase naming convention.
listener - an event listener of type Map<E extends Event> void removeEventListener(@Nonnull Class<E> eventClass, @Nonnull CallableWithArgs<?> listener)
eventClass - the type of the eventlistener - an event listenervoid publishEvent(@Nonnull String eventName)
Listeners will be notified in the same thread as the publisher.
eventName - the name of the eventvoid publishEvent(@Nonnull String eventName, @Nullable List<?> args)
Listeners will be notified in the same thread as the publisher.
eventName - the name of the eventargs - event arguments sent to listenersvoid publishEvent(@Nonnull Event event)
Listeners will be notified in the same thread as the publisher.
event - the event to be publishedvoid publishEventOutsideUI(@Nonnull String eventName)
Listeners will be notified outside of the UI thread.
eventName - the name of the eventvoid publishEventOutsideUI(@Nonnull String eventName, @Nullable List<?> args)
Listeners will be notified outside of the UI thread.
eventName - the name of the eventargs - event arguments sent to listenersvoid publishEventOutsideUI(@Nonnull Event event)
Listeners will be notified outside of the UI thread.
event - the event to be publishedvoid publishEventAsync(@Nonnull String eventName)
Listeners will be notified in a different thread.
eventName - the name of the eventvoid publishEventAsync(@Nonnull String eventName, @Nullable List<?> args)
Listeners will be notified in a different thread.
eventName - the name of the eventargs - event arguments sent to listenersvoid publishEventAsync(@Nonnull Event event)
Listeners will be notified in a different thread.
event - the event to be publishedboolean isEventPublishingEnabled()
void setEventPublishingEnabled(boolean enabled)
enabled - the value fot the enabled state.