Interface ObserverMethod<T>
- 
- Type Parameters:
- T- the event type
 - All Superinterfaces:
- Prioritized
 
 public 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)ornotify(EventContext), the container automatically detects the problem and treats it as a definition error.- Author:
- Gavin King, David Allen, Mark Paluch, Antoine Sabot-Durand
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intDEFAULT_PRIORITY
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Class<?>getBeanClass()Obtains the class of the type that declares the observer method.default Bean<?>getDeclaringBean()Obtains the bean that declares the observer method.Set<Annotation>getObservedQualifiers()Obtains the set of observed event qualifiers.TypegetObservedType()Obtains the observed event type.default intgetPriority()The priority that will be used by the container to determine the notification order in which event observer methods are invoked.ReceptiongetReception()Obtains the specifiedReceptionfor the observer method.TransactionPhasegetTransactionPhase()Obtains the specifiedTransactionPhasefor the observer method.default booleanisAsync()Determines if this observer method is asynchronousdefault voidnotify(EventContext<T> eventContext)Calls the observer method, passing the given event context.default voidnotify(T event)Calls the observer method, passing the given event object.
 
- 
- 
- 
Field Detail- 
DEFAULT_PRIORITYstatic final int DEFAULT_PRIORITY - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getBeanClassClass<?> getBeanClass() Obtains the class of the type that declares the observer method. - Returns:
- the defining class
 
 - 
getDeclaringBeandefault Bean<?> getDeclaringBean() Obtains the bean that declares the observer method. For synthetic observers, the return value is undefined. For the sake of compatibility with existing custom ObserverMethodimplementations, this method by default returnsnull.- Returns:
- the declaring bean
 
 - 
getObservedTypeType getObservedType() Obtains the observed event type.- Returns:
- the observed event type
 
 - 
getObservedQualifiersSet<Annotation> getObservedQualifiers() Obtains the set of observed event qualifiers.- Returns:
- the observed event qualifiers
 
 - 
getReceptionReception getReception() Obtains the specifiedReceptionfor the observer method. This indicates if the observer is conditional or not.- Returns:
- the Reception
 
 - 
getTransactionPhaseTransactionPhase getTransactionPhase() Obtains the specifiedTransactionPhasefor the observer method.- Returns:
- the TransactionPhase
 
 - 
getPrioritydefault int getPriority() The priority that will be used by the container to determine the notification order in which event observer methods are invoked.- Specified by:
- getPriorityin interface- Prioritized
- Returns:
- The priority that will be used by the container to determine the notification order in which event observer methods are invoked.
- Since:
- 2.0
 
 - 
notifydefault 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()returnsReception.IF_EXISTS.- Parameters:
- event- the event object
 
 - 
notifydefault void notify(EventContext<T> eventContext) Calls the observer method, passing the given event context.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()returnsReception.IF_EXISTS.- Parameters:
- eventContext-- EventContextused to notify observers
 
 - 
isAsyncdefault boolean isAsync() Determines if this observer method is asynchronous - Returns:
- returns trueif the method is an asynchronous observer method (i.e. defined withObservesAsync), otherwise returnsfalse
 
 
- 
 
-