javax.enterprise.event
Annotation Type Observes


@Target(value=PARAMETER)
@Retention(value=RUNTIME)
@Documented
public @interface Observes

Identifies the event parameter of an observer method. May be applied to a parameter of a method of a bean class or extension.

 public void afterLogin(@Observes LoggedInEvent event) { ... }
 

An observer method is a non-abstract method of a managed bean class or session bean class (or of an extension). An observer method may be either static or non-static. If the bean is a session bean, the observer method must be either a business method of the EJB or a static method of the bean class.

Each observer method must have exactly one event parameter, of the same type as the event type it observes. Event qualifiers may be declared by annotating the event parameter. When searching for observer methods for an event, the container considers the type and qualifiers of the event parameter.

If the event parameter does not explicitly declare any qualifier, the observer method observes events with no qualifier.

The event parameter type may contain a type variable or wildcard.

A bean (or extension) may declare multiple observer methods.

Observer methods are inherited by bean subclasses.

Interceptors and decorators may not declare observer methods.

Author:
Gavin King, Pete Muir, David Allen

Optional Element Summary
 TransactionPhase during
          Specifies at what time the observer method is notified.
 Reception notifyObserver
          Specifies under what conditions the observer method is notified.
 

notifyObserver

public abstract Reception notifyObserver

Specifies under what conditions the observer method is notified.

By default, the observer method is notified even if no instance of the bean that defines the observer method already exists in the current context.

Default:
javax.enterprise.event.Reception.ALWAYS

during

public abstract TransactionPhase during

Specifies at what time the observer method is notified.

By default, the observer method is notified when the event is fired.

Default:
javax.enterprise.event.TransactionPhase.IN_PROGRESS


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