Package dev.siroshun.event4j.api.caller
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.
An interface to call events.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> @NotNull EventCaller<E>
asyncCaller
(@NotNull EventCaller<E> caller, @NotNull Executor executor) void
Calls the event.default <T extends E>
voidCalls the event.
-
Method Details
-
asyncCaller
@Contract(value="_, _ -> new", pure=true) @NotNull static <E> @NotNull EventCaller<E> asyncCaller(@NotNull @NotNull EventCaller<E> caller, @NotNull @NotNull Executor executor) - Type Parameters:
E
- the event type- Parameters:
caller
- the originalEventCaller
executor
- theExecutor
to use callingcall(Object)
- Returns:
- a new
EventCaller
-
call
Calls the event.- Parameters:
event
- the event instance
-
call
Calls the event.- Type Parameters:
T
- the event type that inherits fromEventCaller
- Parameters:
event
- the event instancecallback
- theConsumer
that accepts the event after calling.
-