Event manager is used by generated code to manage events and listeners.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
emit
(ResolvedType eventObjectType, Object eventObject, Set<Qualifier> qualifiers) Emit an event.<T> CompletionStage
<T> emitAsync
(ResolvedType eventObjectType, T eventObject, Set<Qualifier> qualifiers) Emit an asynchronous event.<T> void
register
(ResolvedType eventType, Consumer<T> eventConsumer, Set<Qualifier> qualifiers) Register an event consumer.<T> void
registerAsync
(ResolvedType eventType, Consumer<T> eventConsumer, Set<Qualifier> qualifiers) Register an asynchronous event consumer.
-
Method Details
-
register
Register an event consumer.- Type Parameters:
T
- type of the event object- Parameters:
eventType
- type of eventeventConsumer
- consumer accepting the eventqualifiers
- qualifiers the consumer is interested in
-
registerAsync
<T> void registerAsync(ResolvedType eventType, Consumer<T> eventConsumer, Set<Qualifier> qualifiers) Register an asynchronous event consumer.- Type Parameters:
T
- type of the event object- Parameters:
eventType
- type of eventeventConsumer
- consumer accepting the eventqualifiers
- qualifiers the consumer is interested in
-
emit
Emit an event.- Parameters:
eventObjectType
- type of eventeventObject
- event object instancequalifiers
- qualifiers of the producer of the event
-
emitAsync
<T> CompletionStage<T> emitAsync(ResolvedType eventObjectType, T eventObject, Set<Qualifier> qualifiers) Emit an asynchronous event.- Type Parameters:
T
- type of the event object- Parameters:
eventObjectType
- type of eventeventObject
- event object instancequalifiers
- qualifiers of the producer of the event- Returns:
- completion stage that completes when all synchronous event observers are notified; it may end exceptionally,
if any of these throws an exception - in such a case all exceptions are available through the cause, or suppressed
exceptions of
EventDispatchException
-