Package org.apache.webbeans.event
Class ObserverMethodImpl<T>
java.lang.Object
org.apache.webbeans.event.ObserverMethodImpl<T>
- Type Parameters:
T- event type
- All Implemented Interfaces:
jakarta.enterprise.inject.spi.ObserverMethod<T>,jakarta.enterprise.inject.spi.Prioritized,OwbObserverMethod<T>
- Direct Known Subclasses:
ContainerEventObserverMethodImpl
Defines observers that are declared in observer methods.
Example:
public class X {
public void afterLoggedIn(@Observes @Current LoggedInEvent event)
{
.....
}
}
Above class X instance observes for the event with type LoggedInEvent
and event qualifier is Current. Whenever event is fired, its jakarta.enterprise.inject.spi.ObserverMethod#notify()
method is called.
- Version:
- $Rev$ $Date$
-
Field Summary
Fields inherited from interface jakarta.enterprise.inject.spi.ObserverMethod
DEFAULT_PRIORITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionObserverMethodImpl(AbstractOwbBean<?> ownerBean, jakarta.enterprise.inject.spi.AnnotatedMethod<T> annotatedObserverMethod, jakarta.enterprise.inject.spi.AnnotatedParameter<T> annotatedObservesParameter) used if the qualifiers and event type are already known, e.g. from the XML.protectedObserverMethodImpl(AbstractOwbBean<?> ownerBean, jakarta.enterprise.inject.spi.AnnotatedMethod<T> annotatedObserverMethod, jakarta.enterprise.inject.spi.AnnotatedParameter<T> annotatedObservesParameter, boolean fireEvent) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckObserverCondition(jakarta.enterprise.inject.spi.AnnotatedParameter<T> annotatedObservesParameter) Class<?>Returns observer owner bean.Set<jakarta.enterprise.inject.spi.InjectionPoint>Returns theInjectionPoints for the parameters of this observer method.protected List<org.apache.webbeans.event.ObserverMethodImpl.ObserverParams>getMethodArguments(Object event, jakarta.enterprise.inject.spi.EventMetadata metadata) Gets observer method parameters.jakarta.enterprise.inject.spi.AnnotatedMethod<T>intjakarta.enterprise.event.Receptionjakarta.enterprise.event.TransactionPhaseprotected WebBeansContextprotected voidbooleanisAsync()voidvoidDeprecated.actually.voidsetObserverMethod(jakarta.enterprise.inject.spi.AnnotatedMethod<T> m) Provides a way to set the observer method.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.webbeans.event.OwbObserverMethod
getDeclaringBean
-
Constructor Details
-
ObserverMethodImpl
public ObserverMethodImpl(AbstractOwbBean<?> ownerBean, jakarta.enterprise.inject.spi.AnnotatedMethod<T> annotatedObserverMethod, jakarta.enterprise.inject.spi.AnnotatedParameter<T> annotatedObservesParameter) used if the qualifiers and event type are already known, e.g. from the XML. -
ObserverMethodImpl
protected ObserverMethodImpl(AbstractOwbBean<?> ownerBean, jakarta.enterprise.inject.spi.AnnotatedMethod<T> annotatedObserverMethod, jakarta.enterprise.inject.spi.AnnotatedParameter<T> annotatedObservesParameter, boolean fireEvent)
-
-
Method Details
-
checkObserverCondition
protected void checkObserverCondition(jakarta.enterprise.inject.spi.AnnotatedParameter<T> annotatedObservesParameter) -
getOwnerBean
- Specified by:
getOwnerBeanin interfaceOwbObserverMethod<T>
-
isAsync
public boolean isAsync()- Specified by:
isAsyncin interfacejakarta.enterprise.inject.spi.ObserverMethod<T>
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfacejakarta.enterprise.inject.spi.ObserverMethod<T>- Specified by:
getPriorityin interfacejakarta.enterprise.inject.spi.Prioritized
-
getInjectionPoints
Returns theInjectionPoints for the parameters of this observer method.- Specified by:
getInjectionPointsin interfaceOwbObserverMethod<T>
-
notify
Deprecated.actually. Use the method with the EventContext instead- Specified by:
notifyin interfacejakarta.enterprise.inject.spi.ObserverMethod<T>
-
notify
- Specified by:
notifyin interfacejakarta.enterprise.inject.spi.ObserverMethod<T>
-
invoke
protected void invoke(Object object, Object[] args) throws IllegalAccessException, InvocationTargetException -
getMethodArguments
protected List<org.apache.webbeans.event.ObserverMethodImpl.ObserverParams> getMethodArguments(Object event, jakarta.enterprise.inject.spi.EventMetadata metadata) Gets observer method parameters.- Parameters:
event- event payload- Returns:
- observer method parameters
-
getBeanClass
Returns observer owner bean.- Specified by:
getBeanClassin interfacejakarta.enterprise.inject.spi.ObserverMethod<T>- Returns:
- the bean
-
getObservedQualifiers
- Specified by:
getObservedQualifiersin interfacejakarta.enterprise.inject.spi.ObserverMethod<T>
-
getObservedType
- Specified by:
getObservedTypein interfacejakarta.enterprise.inject.spi.ObserverMethod<T>
-
getReception
public jakarta.enterprise.event.Reception getReception()- Specified by:
getReceptionin interfacejakarta.enterprise.inject.spi.ObserverMethod<T>
-
getTransactionPhase
public jakarta.enterprise.event.TransactionPhase getTransactionPhase()- Specified by:
getTransactionPhasein interfacejakarta.enterprise.inject.spi.ObserverMethod<T>
-
getObserverMethod
-
getWebBeansContext
-
setObserverMethod
Provides a way to set the observer method. This may need to be done for EJBs so that the method used will be from an interface and not the EJB class that likely can not be invoked on the EJB proxy- Parameters:
m- method to be invoked as the observer
-