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 public interface EventCaller<E>
An interface to call events.
  • Method Details

    • asyncCaller

      @Contract(value="_, _ -> new", pure=true) @NotNull static <E> @NotNull EventCaller<E> asyncCaller(@NotNull @NotNull EventCaller<E> caller, @NotNull @NotNull 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(@NotNull E event)
      Calls the event.
      Parameters:
      event - the event instance
    • call

      default <T extends E> void call(@NotNull T event, @NotNull @NotNull 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.