Interface IEventBus

All Superinterfaces:
IEventRegistry
All Known Implementing Classes:
EventBus

public interface IEventBus extends IEventRegistry
The event bus interface for dispatching events and managing event listeners.
  • 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 CompletableFuture that 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.