org.jboss.webbeans.event
Class ObserverImpl<T>

java.lang.Object
  extended by org.jboss.webbeans.event.ObserverImpl<T>
All Implemented Interfaces:
Observer<T>

public class ObserverImpl<T>
extends java.lang.Object
implements Observer<T>

Reference implementation for the Observer 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

Nested Class Summary
protected static class ObserverImpl.TransactionObservationPhase
          The known transactional phases a transactional event observer can be interested in
 
Constructor Summary
protected ObserverImpl(AnnotatedMethod<?> observer, Bean<?> observerBean, ManagerImpl manager)
          Creates an Observer which describes and encapsulates an observer method (8.5).
 
Method Summary
 java.lang.annotation.Annotation[] getBindingsAsArray()
           
 java.lang.Class<T> getEventType()
           
 boolean isConditional()
          Indicates if the observer is conditional
 boolean isInterestedInTransactionPhase(ObserverImpl.TransactionObservationPhase currentPhase)
          Checks if the observer is interested in a particular transactional phase
 boolean isTransactional()
          Indicates if the observer is transactional
 void notify(T event)
           
static
<T> ObserverImpl<T>
of(AnnotatedMethod<?> method, AbstractClassBean<?> declaringBean, ManagerImpl manager)
          Creates an observer
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObserverImpl

protected ObserverImpl(AnnotatedMethod<?> observer,
                       Bean<?> observerBean,
                       ManagerImpl manager)
Creates an Observer which describes and encapsulates an observer method (8.5).

Parameters:
observer - The observer
observerBean - The observer bean
manager - The Web Beans manager
Method Detail

of

public static <T> ObserverImpl<T> of(AnnotatedMethod<?> method,
                                     AbstractClassBean<?> declaringBean,
                                     ManagerImpl manager)
Creates an observer

Parameters:
method - The observer method abstraction
declaringBean - The declaring bean
manager - The Web Beans manager
Returns:
An observer implementation built from the method abstraction

notify

public void notify(T event)
Specified by:
notify in interface Observer<T>

isTransactional

public boolean isTransactional()
Indicates if the observer is transactional

Returns:
True if transactional, false otherwise

isConditional

public boolean isConditional()
Indicates if the observer is conditional

Returns:
True if conditional, false otherwise

isInterestedInTransactionPhase

public boolean isInterestedInTransactionPhase(ObserverImpl.TransactionObservationPhase currentPhase)
Checks if the observer is interested in a particular transactional phase

Parameters:
currentPhase - The phase to check
Returns:
True if interested, false otherwise

toString

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

getEventType

public java.lang.Class<T> getEventType()

getBindingsAsArray

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


Copyright © 2008-2009. All Rights Reserved.