public interface IEventBus
#create()
and #create(IEventExceptionHandler)
修飾子とタイプ | メソッドと説明 |
---|---|
<T extends GenericEvent<? extends F>,F> |
addGenericListener(java.lang.Class<F> genericClassFilter,
java.util.function.Consumer<T> consumer)
Add a consumer listener for a
GenericEvent subclass, filtered to only be called for the specified
filter Class . |
<T extends GenericEvent<? extends F>,F> |
addGenericListener(java.lang.Class<F> genericClassFilter,
EventPriority priority,
boolean receiveCancelled,
java.lang.Class<T> eventType,
java.util.function.Consumer<T> consumer)
Add a consumer listener with the specified
EventPriority and potentially cancelled events,
for a GenericEvent subclass, filtered to only be called for the specified
filter Class . |
<T extends GenericEvent<? extends F>,F> |
addGenericListener(java.lang.Class<F> genericClassFilter,
EventPriority priority,
boolean receiveCancelled,
java.util.function.Consumer<T> consumer)
Add a consumer listener with the specified
EventPriority and potentially cancelled events,
for a GenericEvent subclass, filtered to only be called for the specified
filter Class . |
<T extends GenericEvent<? extends F>,F> |
addGenericListener(java.lang.Class<F> genericClassFilter,
EventPriority priority,
java.util.function.Consumer<T> consumer)
Add a consumer listener with the specified
EventPriority and not receiving cancelled events,
for a GenericEvent subclass, filtered to only be called for the specified
filter Class . |
<T extends Event> |
addListener(java.util.function.Consumer<T> consumer)
Add a consumer listener with default
EventPriority.NORMAL and not recieving cancelled events. |
<T extends Event> |
addListener(EventPriority priority,
boolean receiveCancelled,
java.lang.Class<T> eventType,
java.util.function.Consumer<T> consumer)
Add a consumer listener with the specified
EventPriority and potentially cancelled events. |
<T extends Event> |
addListener(EventPriority priority,
boolean receiveCancelled,
java.util.function.Consumer<T> consumer)
Add a consumer listener with the specified
EventPriority and potentially cancelled events. |
<T extends Event> |
addListener(EventPriority priority,
java.util.function.Consumer<T> consumer)
Add a consumer listener with the specified
EventPriority and not receiving cancelled events. |
boolean |
post(Event event)
Submit the event for dispatch to appropriate listeners
|
void |
register(java.lang.Object target)
Register an instance object or a Class, and add listeners for all
SubscribeEvent annotated methods
found there. |
void |
shutdown()
Shuts down this event bus.
|
void |
start() |
void |
unregister(java.lang.Object object)
Unregister the supplied listener from this EventBus.
|
void register(java.lang.Object target)
SubscribeEvent
annotated methods
found there.
Depending on what is passed as an argument, different listener creation behaviour is performed.
SubscribeEvent
and creates listeners for
each method found.SubscribeEvent
and creates listeners for
each method found.target
- Either a Class
instance or an arbitrary object, for scanning and event listener creation<T extends Event> void addListener(java.util.function.Consumer<T> consumer)
EventPriority.NORMAL
and not recieving cancelled events.T
- The Event
subclass to listen forconsumer
- Callback to invoke when a matching event is received<T extends Event> void addListener(EventPriority priority, java.util.function.Consumer<T> consumer)
EventPriority
and not receiving cancelled events.T
- The Event
subclass to listen forpriority
- EventPriority
for this listenerconsumer
- Callback to invoke when a matching event is received<T extends Event> void addListener(EventPriority priority, boolean receiveCancelled, java.util.function.Consumer<T> consumer)
EventPriority
and potentially cancelled events.T
- The Event
subclass to listen forpriority
- EventPriority
for this listenerreceiveCancelled
- Indicate if this listener should receive events that have been Cancelable
cancelledconsumer
- Callback to invoke when a matching event is received<T extends Event> void addListener(EventPriority priority, boolean receiveCancelled, java.lang.Class<T> eventType, java.util.function.Consumer<T> consumer)
EventPriority
and potentially cancelled events.
Use this method when one of the other methods fails to determine the concrete Event
subclass that is
intended to be subscribed to.T
- The Event
subclass to listen forpriority
- EventPriority
for this listenerreceiveCancelled
- Indicate if this listener should receive events that have been Cancelable
cancelledeventType
- The concrete Event
subclass to subscribe toconsumer
- Callback to invoke when a matching event is received<T extends GenericEvent<? extends F>,F> void addGenericListener(java.lang.Class<F> genericClassFilter, java.util.function.Consumer<T> consumer)
GenericEvent
subclass, filtered to only be called for the specified
filter Class
.T
- The GenericEvent
subclass to listen forF
- The Class
to filter the GenericEvent
forgenericClassFilter
- A Class
which the GenericEvent
should be filtered forconsumer
- Callback to invoke when a matching event is received<T extends GenericEvent<? extends F>,F> void addGenericListener(java.lang.Class<F> genericClassFilter, EventPriority priority, java.util.function.Consumer<T> consumer)
EventPriority
and not receiving cancelled events,
for a GenericEvent
subclass, filtered to only be called for the specified
filter Class
.T
- The GenericEvent
subclass to listen forF
- The Class
to filter the GenericEvent
forgenericClassFilter
- A Class
which the GenericEvent
should be filtered forpriority
- EventPriority
for this listenerconsumer
- Callback to invoke when a matching event is received<T extends GenericEvent<? extends F>,F> void addGenericListener(java.lang.Class<F> genericClassFilter, EventPriority priority, boolean receiveCancelled, java.util.function.Consumer<T> consumer)
EventPriority
and potentially cancelled events,
for a GenericEvent
subclass, filtered to only be called for the specified
filter Class
.T
- The GenericEvent
subclass to listen forF
- The Class
to filter the GenericEvent
forgenericClassFilter
- A Class
which the GenericEvent
should be filtered forpriority
- EventPriority
for this listenerreceiveCancelled
- Indicate if this listener should receive events that have been Cancelable
cancelledconsumer
- Callback to invoke when a matching event is received<T extends GenericEvent<? extends F>,F> void addGenericListener(java.lang.Class<F> genericClassFilter, EventPriority priority, boolean receiveCancelled, java.lang.Class<T> eventType, java.util.function.Consumer<T> consumer)
EventPriority
and potentially cancelled events,
for a GenericEvent
subclass, filtered to only be called for the specified
filter Class
.
Use this method when one of the other methods fails to determine the concrete GenericEvent
subclass that is
intended to be subscribed to.T
- The GenericEvent
subclass to listen forF
- The Class
to filter the GenericEvent
forgenericClassFilter
- A Class
which the GenericEvent
should be filtered forpriority
- EventPriority
for this listenerreceiveCancelled
- Indicate if this listener should receive events that have been Cancelable
cancelledeventType
- The concrete GenericEvent
subclass to subscribe toconsumer
- Callback to invoke when a matching event is receivedvoid unregister(java.lang.Object object)
object
- The object, Class
or Consumer
to unsubscribe.boolean post(Event event)
event
- The event to dispatch to listenersCancelable
cancelledvoid shutdown()
post(Event)
will be a no op after this method has been invokedvoid start()