Contents
Interface IEventBus
- All Superinterfaces:
IEventRegistry
- All Known Implementing Classes:
EventBus
The event bus interface for dispatching events and managing event listeners.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <KeyType, EventType extends IEvent<KeyType>>
EventTypeCalled to dispatch an event of the specified class.default <EventType extends IAsyncEvent<Void>>
CompletableFuture<EventType> dispatchAsync(Class<EventType> eventClass) Called to dispatch an asynchronous event of the specified class.default <KeyType, EventType extends IEvent<KeyType>>
IEventDispatcher<EventType, EventType> dispatchFor(Class<? super EventType> eventClass) Called to get an event dispatcher for the specified event class.<KeyType, EventType extends IEvent<KeyType>>
IEventDispatcher<EventType, EventType> dispatchFor(Class<? super EventType> eventClass, KeyType key) Called to get an event dispatcher for the specified event class and key.default <KeyType, EventType extends IAsyncEvent<KeyType>>
IEventDispatcher<EventType, CompletableFuture<EventType>> dispatchForAsync(Class<? super EventType> eventClass) Called to get an asynchronous event dispatcher for the specified event class.<KeyType, EventType extends IAsyncEvent<KeyType>>
IEventDispatcher<EventType, CompletableFuture<EventType>> dispatchForAsync(Class<? super EventType> eventClass, KeyType key) Called to get an asynchronous event dispatcher for the specified event class and key.Methods inherited from interface IEventRegistry
register, register, register, register, register, register, registerAsync, registerAsync, registerAsync, registerAsync, registerAsync, registerAsync, registerAsyncGlobal, registerAsyncGlobal, registerAsyncGlobal, registerAsyncUnhandled, registerAsyncUnhandled, registerAsyncUnhandled, registerGlobal, registerGlobal, registerGlobal, registerUnhandled, registerUnhandled, registerUnhandled
-
Method Details
-
dispatch
default <KeyType, EventType extends IEvent<KeyType>> EventType dispatch(@Nonnull Class<EventType> eventClass) Called to dispatch an event of the specified class.- Type Parameters:
KeyType- The key type filter for this event call.EventType- The event type.- Parameters:
eventClass- The event class to dispatch.- Returns:
- the dispatched event instance.
-
dispatchAsync
default <EventType extends IAsyncEvent<Void>> CompletableFuture<EventType> dispatchAsync(@Nonnull Class<EventType> eventClass) Called to dispatch an asynchronous event of the specified class.- Type Parameters:
EventType- The event type.- Parameters:
eventClass- The event class to dispatch.- Returns:
- a
CompletableFuturethat will complete with the dispatched event instance.
-
dispatchFor
default <KeyType, EventType extends IEvent<KeyType>> IEventDispatcher<EventType, EventType> dispatchFor(@Nonnull Class<? super EventType> eventClass) Called to get an event dispatcher for the specified event class.- Type Parameters:
KeyType- The key type filter for this event call.EventType- The event type.- Parameters:
eventClass- The event class to get the dispatcher for.- Returns:
- the event dispatcher.
-
dispatchFor
<KeyType, EventType extends IEvent<KeyType>> IEventDispatcher<EventType, EventType> dispatchFor(@Nonnull Class<? super EventType> eventClass, @Nullable KeyType key) Called to get an event dispatcher for the specified event class and key.- Type Parameters:
KeyType- The key type filter for this event call.EventType- The event type.- Parameters:
eventClass- The event class to get the dispatcher for.key- The key to filter events by.- Returns:
- the event dispatcher.
-
dispatchForAsync
default <KeyType, EventType extends IAsyncEvent<KeyType>> IEventDispatcher<EventType, CompletableFuture<EventType>> dispatchForAsync(@Nonnull Class<? super EventType> eventClass) Called to get an asynchronous event dispatcher for the specified event class.- Type Parameters:
KeyType- The key type filter for this event call.EventType- The event type.- Parameters:
eventClass- The event class to get the dispatcher for.- Returns:
- the asynchronous event dispatcher.
-
dispatchForAsync
<KeyType, EventType extends IAsyncEvent<KeyType>> IEventDispatcher<EventType, CompletableFuture<EventType>> dispatchForAsync(@Nonnull Class<? super EventType> eventClass, @Nullable KeyType key) Called to get an asynchronous event dispatcher for the specified event class and key.- Type Parameters:
KeyType- The key type filter for this event call.EventType- The event type.- Parameters:
eventClass- The event class to get the dispatcher for.key- The key to filter events by.- Returns:
- the asynchronous event dispatcher.
-