public interface EventPublisher
| Modifier and Type | Method and Description | 
|---|---|
| <E extends Event> | addEventListener(Class<E> eventClass,
                CallableWithArgs<?> listener)Deprecated. 
 use the  RunnableWithArgsvariant instead. | 
| <E extends Event> | addEventListener(Class<E> eventClass,
                RunnableWithArgs listener)Adds a callable as an event listener. | 
| void | addEventListener(Map<String,Object> listener)Adds a Map containing event listeners. | 
| void | addEventListener(Object listener)Adds an event listener. | 
| void | addEventListener(String eventName,
                CallableWithArgs<?> listener)Deprecated. 
 use the  RunnableWithArgsvariant instead. | 
| void | addEventListener(String eventName,
                RunnableWithArgs listener)Adds a callable as an event listener. | 
| Collection<Object> | getEventListeners()Returns an immutable snapshot view of all event listeners registered. | 
| Collection<Object> | getEventListeners(String eventName)Returns an immutable snapshot view of all event listeners registered for the target event name. | 
| 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)Deprecated. 
 use the  RunnableWithArgsvariant instead. | 
| <E extends Event> | removeEventListener(Class<E> eventClass,
                   RunnableWithArgs listener)Removes a callable as an event listener. | 
| void | removeEventListener(Map<String,Object> listener)Removes a Map containing event listeners. | 
| void | removeEventListener(Object listener)Removes an event listener. | 
| void | removeEventListener(String eventName,
                   CallableWithArgs<?> listener)Deprecated. 
 use the  RunnableWithArgsvariant instead. | 
| void | removeEventListener(String eventName,
                   RunnableWithArgs 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 RunnableWithArgs listener)
eventName - the name of the eventlistener - an event listener@Deprecated void addEventListener(@Nonnull String eventName, @Nonnull CallableWithArgs<?> listener)
RunnableWithArgs variant instead.eventName - the name of the eventlistener - an event listenervoid addEventListener(@Nonnull Map<String,Object> listener)
An event listener may be
Maps require handlers to be named as eventName only.
Some examples of eventHandler names are: StartupStart, MyCoolEvent. Event names must follow the camelCase naming convention.
listener - an event listener of type Map@Deprecated <E extends Event> void addEventListener(@Nonnull Class<E> eventClass, @Nonnull CallableWithArgs<?> listener)
RunnableWithArgs variant instead.eventClass - the type of the eventlistener - an event listener<E extends Event> void addEventListener(@Nonnull Class<E> eventClass, @Nonnull RunnableWithArgs 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 RunnableWithArgs listener)
eventName - the name of the eventlistener - an event listener@Deprecated void removeEventListener(@Nonnull String eventName, @Nonnull CallableWithArgs<?> listener)
RunnableWithArgs variant instead.eventName - the name of the eventlistener - an event listenervoid removeEventListener(@Nonnull Map<String,Object> listener)
An event listener may be
Maps require handlers to be named as eventName only.
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 RunnableWithArgs listener)
eventClass - the type of the eventlistener - an event listener@Deprecated <E extends Event> void removeEventListener(@Nonnull Class<E> eventClass, @Nonnull CallableWithArgs<?> listener)
RunnableWithArgs variant instead.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.@Nonnull Collection<Object> getEventListeners()
@Nonnull Collection<Object> getEventListeners(@Nonnull String eventName)
eventName - the name of the event