Top Description Methods
jakarta.faces.event

public @Interface ListenerFor

extends Annotation
Annotations
@Retention:RUNTIME
@Target:TYPE
@Inherited
@Repeatable:ListenersFor
Imports
java.lang.annotation.ElementType, .Inherited, .Repeatable, .Retention, .RetentionPolicy, .Target

Classes tagged with this annotation are installed as listeners using the method jakarta.faces.application.Application#subscribeToEvent or jakarta.faces.component.UIComponent#subscribeToEvent (depending on the circumstances, described below).

The default implementation must support attaching this annotation to jakarta.faces.component.UIComponent or jakarta.faces.render.Renderer classes. In both cases, the annotation processing described herein must commence during the implementation of any variant of jakarta.faces.application.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 jakarta.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 to all components that list it as their renderer.

Since
2.0

Method Summary

Modifier and TypeMethod and Description
public Class<T>

Returns:

the source class
sourceClass
()

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

public Class<? extends SystemEvent>

Returns:

the event class
systemEventClass
()

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

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

sourceClassback to summary
public Class<T> sourceClass()

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

Returns:Class<T>

the source class

systemEventClassback to summary
public 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.

Returns:Class<? extends SystemEvent>

the event class