T
- the event typepublic interface ObserverMethod<T> extends Prioritized
Represents an observer method of an enabled bean. Defines everything the container needs to know about an observer method.
If a custom implementation of this interface does not override either notify(Object)
or
notify(EventContext)
, the container automatically detects the problem and treats it as a definition error.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PRIORITY |
Modifier and Type | Method and Description |
---|---|
Class<?> |
getBeanClass()
Obtains the class of the type that declares the observer method.
|
Set<Annotation> |
getObservedQualifiers()
Obtains the set of observed event qualifiers.
|
Type |
getObservedType()
Obtains the observed event type.
|
default int |
getPriority()
The priority that will be used by the container to determine the notification order in which event observer
methods are invoked.
|
Reception |
getReception()
Obtains the specified
Reception for the observer method. |
TransactionPhase |
getTransactionPhase()
Obtains the specified
TransactionPhase for the observer method. |
default boolean |
isAsync()
Determines if this observer method is asynchronous
|
default void |
notify(EventContext<T> eventContext)
Calls the observer method, passing the given event context.
|
default void |
notify(T event)
Calls the observer method, passing the given event object.
|
static final int DEFAULT_PRIORITY
Class<?> getBeanClass()
Obtains the class of the type that declares the observer method.
Type getObservedType()
Set<Annotation> getObservedQualifiers()
Reception getReception()
Reception
for the observer method. This indicates if the observer is conditional or not.Reception
TransactionPhase getTransactionPhase()
TransactionPhase
for the observer method.TransactionPhase
default int getPriority()
getPriority
in interface Prioritized
default void notify(T event)
Calls the observer method, passing the given event object.
The implementation of this method for a custom observer method is responsible for deciding whether to call
the method if the getReception()
returns Reception.IF_EXISTS
.
event
- the event objectdefault void notify(EventContext<T> eventContext)
The container should always call this method, but the default implementation delegates to notify(Object)
.
The implementation of this method for a custom observer method is responsible for deciding whether to call the method if
the getReception()
returns Reception.IF_EXISTS
.
eventContext
- EventContext
used to notify observersdefault boolean isAsync()
Determines if this observer method is asynchronous
true
if the method is an asynchronous observer method (i.e. defined with ObservesAsync
),
otherwise returns false
Copyright © 2018,2020 Eclipse Foundation.
Use is subject to license terms.