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

Field Summary
protected  ManagerImpl manager
           
protected  Bean<?> observerBean
           
protected  MethodInjectionPoint<?> observerMethod
           
 
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.reflect.Type getEventType()
           
 void initialize()
          Completes initialization of the observer and allows derived types to override behavior.
 boolean isConditional()
          Indicates if the observer is conditional
 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

observerBean

protected final Bean<?> observerBean

observerMethod

protected final MethodInjectionPoint<?> observerMethod

manager

protected ManagerImpl manager
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

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 Observer<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 -

isConditional

public boolean isConditional()
Indicates if the observer is conditional

Returns:
True if conditional, false otherwise

toString

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

getEventType

public java.lang.reflect.Type getEventType()

getBindingsAsArray

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


Copyright © 2011. All Rights Reserved.