Class Event<T>
java.lang.Object
io.avaje.inject.events.Event<T>
- Type Parameters:
T- the type of the event object
Allows the application to fire events of a particular type.
Beans fire events via an instance of the Event abstract class, which may be
injected:
@Inject
Event<LoggedInEvent> loggedInEvent;
The fire() method accepts an event object:
public void login() {
...
loggedInEvent.fire(new LoggedInEvent(user));
}
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEvent(ObserverManager manager, Type type) protectedEvent(ObserverManager manager, Type type, String qualifier) -
Method Summary
Modifier and TypeMethodDescriptionvoidFires an event and notifies observers with the qualifier set for this instance.voidFires an event with the specified qualifier and notifies observers.Fires an event to asynchronous observers with the qualifier set for this instance.Fires an event with the specified qualifier and notifies asynchronous observers
-
Field Details
-
manager
-
observers
-
defaultQualifier
-
-
Constructor Details
-
Event
-
Event
-
-
Method Details
-
fire
-
fireAsync
Fires an event with the specified qualifier and notifies asynchronous observers- Parameters:
event- the event objectqualifier- the qualifier for this event- Returns:
- a
CompletableFutureallowing further pipeline composition on the asynchronous operation.
-
fire
Fires an event and notifies observers with the qualifier set for this instance.- Parameters:
event- the event object
-
fireAsync
Fires an event to asynchronous observers with the qualifier set for this instance.- Parameters:
event- the event object- Returns:
- a
CompletionStageallowing further pipeline composition on the asynchronous operation.
-