javax.faces.event
Annotation Type ListenerFor


@Retention(value=RUNTIME)
@Target(value=TYPE)
@Inherited
public @interface ListenerFor

Classes tagged with this annotation are installed as listeners using the method Application.subscribeToEvent(java.lang.Class, java.lang.Class, javax.faces.event.SystemEventListener) or UIComponent.subscribeToEvent(java.lang.Class, javax.faces.event.ComponentSystemEventListener) (depending on the circumstances, described below).

The default implementation must support attaching this annotation to UIComponent or Renderer classes. In both cases, the annotation processing described herein must commence during the implementation of any variant of Application.createComponent() and must complete before the UIComponent instance is returned from createComponent(). The annotation processing must proceed according to an algorithm semantically equivalent to the following.

Example: The standard renderer for javax.faces.resource.Stylesheet must have the following annotation declaration:

@ListenerFor(systemEventClass=PostAddToViewEvent.class)

This will cause the renderer to be added as a listener for the PostAddToViewEvent no all components that list it as their renderer.

Since:
2.0

Required Element Summary
 Class<? extends SystemEvent> systemEventClass
          

The kind of system event for which this class will be installed as a listener.

 
Optional Element Summary
 Class sourceClass
          

The kind of object that emits events of the type given by the value of the systemEventClass() attribute.

 

Element Detail

systemEventClass

public abstract Class<? extends SystemEvent> systemEventClass

The kind of system event for which this class will be installed as a listener. The implementation only supports exact matches on the Class and must not honor subclass relationships. It is valid to have EL Expressions in the value of this attribute, as long as the expression resolves to an instance of the expected type.

sourceClass

public abstract Class sourceClass

The kind of object that emits events of the type given by the value of the systemEventClass() attribute. It is valid to have EL Expressions in the value of this attribute, as long as the expression resolves to an instance of the expected type.

Default:
java.lang.Void.class


Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.