org.jboss.weld.event
Class ObserverMethodImpl<X,T>

java.lang.Object
  extended by org.jboss.weld.event.ObserverMethodImpl<X,T>
All Implemented Interfaces:
javax.enterprise.inject.spi.ObserverMethod<X,T>

public class ObserverMethodImpl<X,T>
extends java.lang.Object
implements javax.enterprise.inject.spi.ObserverMethod<X,T>

Reference implementation for the ObserverMethod interface, which represents an observer method. Each observer method has an event type which is the class of the event object being observed, and event binding types that are annotations applied to the event parameter to narrow the event notifications delivered.

Author:
David Allen

Field Summary
protected  RIBean<X> declaringBean
           
protected  BeanManagerImpl manager
           
protected  MethodInjectionPoint<T,X> observerMethod
           
protected  javax.enterprise.event.TransactionPhase transactionPhase
           
 
Constructor Summary
protected ObserverMethodImpl(WeldMethod<T,X> observer, RIBean<X> declaringBean, BeanManagerImpl manager)
          Creates an Observer which describes and encapsulates an observer method (8.5).
 
Method Summary
 javax.enterprise.inject.spi.Bean<X> getBean()
           
 java.lang.annotation.Annotation[] getBindingsAsArray()
           
 MethodInjectionPoint<T,X> getMethod()
           
 javax.enterprise.event.Notify getNotify()
           
 java.util.Set<java.lang.annotation.Annotation> getObservedQualifiers()
           
 java.lang.reflect.Type getObservedType()
           
 javax.enterprise.event.TransactionPhase getTransactionPhase()
           
 void initialize()
          Completes initialization of the observer and allows derived types to override behavior.
 void notify(T event)
           
protected  void sendEvent(T event)
          Invokes the observer method immediately passing the event.
protected  void sendEventAsynchronously(T event)
          Queues the event for later execution
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

manager

protected BeanManagerImpl manager

declaringBean

protected final RIBean<X> declaringBean

observerMethod

protected final MethodInjectionPoint<T,X> observerMethod

transactionPhase

protected javax.enterprise.event.TransactionPhase transactionPhase
Constructor Detail

ObserverMethodImpl

protected ObserverMethodImpl(WeldMethod<T,X> observer,
                             RIBean<X> declaringBean,
                             BeanManagerImpl manager)
Creates an Observer which describes and encapsulates an observer method (8.5).

Parameters:
observer - The observer
declaringBean - The observer bean
manager - The Bean manager
Method Detail

getBean

public javax.enterprise.inject.spi.Bean<X> getBean()
Specified by:
getBean in interface javax.enterprise.inject.spi.ObserverMethod<X,T>

getBindingsAsArray

public java.lang.annotation.Annotation[] getBindingsAsArray()

getNotify

public javax.enterprise.event.Notify getNotify()
Specified by:
getNotify in interface javax.enterprise.inject.spi.ObserverMethod<X,T>

getObservedQualifiers

public java.util.Set<java.lang.annotation.Annotation> getObservedQualifiers()
Specified by:
getObservedQualifiers in interface javax.enterprise.inject.spi.ObserverMethod<X,T>

getObservedType

public java.lang.reflect.Type getObservedType()
Specified by:
getObservedType in interface javax.enterprise.inject.spi.ObserverMethod<X,T>

getTransactionPhase

public javax.enterprise.event.TransactionPhase getTransactionPhase()
Specified by:
getTransactionPhase in interface javax.enterprise.inject.spi.ObserverMethod<X,T>

getMethod

public MethodInjectionPoint<T,X> getMethod()
Returns:
the observerMethod

initialize

public void initialize()
Completes initialization of the observer and allows derived types to override behavior.


notify

public void notify(T event)
Specified by:
notify in interface javax.enterprise.inject.spi.ObserverMethod<X,T>

sendEvent

protected void sendEvent(T event)
Invokes the observer method immediately passing the event.

Parameters:
event - The event to notify observer with

sendEventAsynchronously

protected void sendEventAsynchronously(T event)
Queues the event for later execution

Parameters:
event -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008-2009 Seam Framework. All Rights Reserved.