Package dev.siroshun.event4j.tree
Interface TreeEventService<K,E,O>
- Type Parameters:
K
- the key typeE
- the event typeO
- the order type
public interface TreeEventService<K,E,O>
An interface for retrieving an instance of
EventCaller
and ListenerSubscriber
.
When an event is fired, the event's class and parent class listeners (up to the root event class) are invoked. For example, for the root event class A, if there is a B that inherits from A and a C that inherits from it, the listeners are called in the order C -> B -> A.
The implementation of this interface can be created from TreeEventService.Factory
, that is instanced by factory()
method.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A factory interface to createTreeEventService
. -
Method Summary
Modifier and TypeMethodDescription@NotNull EventCaller<E>
caller()
Gets theEventCaller
of thisTreeEventService
.static <K,
E, O> @NotNull TreeEventService.Factory<K, E, O> factory()
Creates a newTreeEventService.Factory
.@NotNull ListenerSubscriber<K,
E, O> Gets theListenerSubscriber
of thisTreeEventService
.
-
Method Details
-
factory
@Contract(value=" -> new", pure=true) static <K,E, @NotNull TreeEventService.Factory<K,O> E, factory()O> Creates a newTreeEventService.Factory
.- Type Parameters:
K
- the key typeE
- the event typeO
- the order type- Returns:
- a new
TreeEventService.Factory
-
caller
Gets theEventCaller
of thisTreeEventService
.- Returns:
- the
EventCaller
-
subscriber
Gets theListenerSubscriber
of thisTreeEventService
.- Returns:
- the
ListenerSubscriber
-