Interface EventCaller<E>

Type Parameters:
E - the event type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @NotNullByDefault public interface EventCaller<E>
An interface to call events.
  • Method Details

    • asyncCaller

      @Contract(value="_, _ -> new", pure=true) static <E> EventCaller<E> asyncCaller(EventCaller<E> caller, Executor executor)
      Creates a new EventCaller that calls call(Object) on the given Executor.
      Type Parameters:
      E - the event type
      Parameters:
      caller - the original EventCaller
      executor - the Executor to use calling call(Object)
      Returns:
      a new EventCaller
    • call

      void call(E event)
      Calls the event.
      Parameters:
      event - the event instance
    • call

      default <T extends E> void call(T event, Consumer<? super T> callback)
      Calls the event.
      Type Parameters:
      T - the event type that inherits from EventCaller
      Parameters:
      event - the event instance
      callback - the Consumer that accepts the event after calling.