Class SimpleEventBus<E>

  • Type Parameters:
    E - the base event type
    All Implemented Interfaces:
    EventBus<E>

    public class SimpleEventBus<E>
    extends Object
    implements EventBus<E>
    A simple implementation of an event bus.
    Since:
    1.0.0
    • Constructor Detail

      • SimpleEventBus

        public SimpleEventBus​(@NotNull
                              @NotNull EventRegistry<E> registry,
                              @NotNull
                              EventBus.EventExceptionHandler exceptions)
        Constructs a new SimpleEventBus.
        Parameters:
        registry - the event registry
        exceptions - the event exception handler
        Since:
        1.0.0
    • Method Detail

      • post

        public void post​(@NotNull
                         E event,
                         @NotNull
                         @NotNull OptionalInt order)
        Description copied from interface: EventBus
        Posts an event to all registered subscribers at the order provided in order.
        Specified by:
        post in interface EventBus<E>
        Parameters:
        event - the event
        order - the order
      • accepts

        protected boolean accepts​(@NotNull
                                  @NotNull EventSubscription<? super E> subscription,
                                  @NotNull
                                  E event,
                                  @NotNull
                                  @NotNull OptionalInt order)