- Type Parameters:
T- - root event type
public sealed interface EventBus<T>
An event bus which dispatches events to subscribed handlers.
-
Method Summary
Modifier and TypeMethodDescriptionchildren()create()static <T> EventBus<T>static <T> EventBus<T>static <T> EventBus<T>create(Class<T> eventType, @Nullable ClassHierarchyService hierarchyService) parent()<E extends T>
booleanpost(E event) Post an event starting from this node.removeChild(EventBus<E> child) subscribe(EventSubscriber<E> subscriber) subscribeAnnotated(Object object) Subscribes all method annotated withSubscribedeclared in the specified object.unsubscribe(EventSubscriber<E> subscriber) unsubscribeAnnotated(Object object) Unsubscribes all methods annotated withSubscribedeclared in the specified object.
-
Method Details
-
create
-
create
-
create
-
create
static <T> EventBus<T> create(Class<T> eventType, @Nullable @Nullable ClassHierarchyService hierarchyService) -
post
Post an event starting from this node.- Parameters:
event- the event to call
-
eventType
-
parent
-
children
-
addChild
-
removeChild
-
subscribeAnnotated
Subscribes all method annotated withSubscribedeclared in the specified object. Passing aClassto this method will subscribe static methods, passing an instance will subscribe instance methods.- Parameters:
object- - an object instance or a class- Returns:
- the event bus
-
unsubscribeAnnotated
Unsubscribes all methods annotated withSubscribedeclared in the specified object. Passing aClassto this method will unsubscribe static methods, passing an instance will unsubscribe instance methods.- Parameters:
object- - an object instance or a class- Returns:
- the event bus
-
subscribe
-
subscribe
-
unsubscribe
-