Top Description Inners Fields Constructors Methods
com.sun.faces.application.annotation

public Class AnnotationManager

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, java.util.Collections, .HashMap, .Map, .Collection, .Set, java.util.concurrent.Callable, .CancellationException, .ConcurrentHashMap, .ConcurrentMap, .ExecutionException, .Future, .FutureTask, java.util.logging.Level, .Logger, javax.faces.FacesException, javax.faces.component.UIComponent, javax.faces.component.behavior.Behavior, .ClientBehaviorBase, javax.faces.context.FacesContext, javax.faces.convert.Converter, javax.faces.render.ClientBehaviorRenderer, .RenderKit, .Renderer, javax.faces.validator.Validator, com.sun.faces.util.FacesLogger, javax.faces.event.SystemEvent

This class represents the central point for annotation handling within a web application.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AnnotationManager.ProcessAnnotationsTask

This Callable will leverage the provided Scanners to build a mapping between a particular annotation type and an AnnotationHandler for that type.

private static enum
AnnotationManager.ProcessingTarget

Enum of the different processing targets and their associated Scanners

Field Summary

Modifier and TypeField and Description
private static final Scanner[]
BEHAVIOR_SCANNERS

Scanner instances to be used against Behavior classes.

private ConcurrentMap<Class<?>, Future<Map<Class<? extends Annotation>, RuntimeAnnotationHandler>>>
cache

The backing cache for all annotation metadata.

private static final Scanner[]
private static final Scanner[]
CONVERTER_SCANNERS

Scanner instances to be used against Converter classes.

private static final Scanner[]
private static final Scanner
private static final Logger
private static final Scanner[]
RENDERER_SCANNERS

Scanner instances to be used against Renderer classes.

private static final Scanner
private static final Scanner[]
UICOMPONENT_SCANNERS

Scanner instances to be used against UIComponent classes.

private static final Scanner[]
VALIDATOR_SCANNERS

Scanner instances to be used against Validator classes.

Constructor Summary

AccessConstructor and Description
public
AnnotationManager()

Construct a new AnnotationManager instance.

Method Summary

Modifier and TypeMethod and Description
private void
applyAnnotations(FacesContext
the javax.faces.context.FacesContext for the current request
ctx
,
Class<?>
class of the processingTarget
targetClass
,
AnnotationManager.ProcessingTarget
the type of component that is being processed
processingTarget
,
Object...
one or more parameters to be passed to each RuntimeAnnotationHandler
params
)

Apply all annotations associated with targetClass

public void
applyBehaviorAnnotations(FacesContext
the javax.faces.context.FacesContext for the current request
ctx
,
Behavior
the target Behavior to process
b
)

Apply annotations relevant to javax.faces.component.behavior.Behavior instances.

public void
applyClientBehaviorRendererAnnotations(FacesContext
the javax.faces.context.FacesContext for the current request
ctx
,
ClientBehaviorRenderer
the target ClientBehaviorRenderer to process
b
)

Apply annotations relevant to javax.faces.render.ClientBehaviorRenderer instances.

public void
applyComponentAnnotations(FacesContext
the javax.faces.context.FacesContext for the current request
ctx
,
UIComponent
the target UIComponent to process
c
)

Apply annotations relevant to javax.faces.component.UIComponent instances.

public void
applyConfigAnnotations(FacesContext
FacesContext available during application initialization
ctx
,
Class<? extends Annotation> annotationType, Set<? extends Class<T>>
Collection of class names known to contain one or more Faces configuration annotations
annotatedClasses
)

Apply the configuration metadata contained with in the Collection of annotated classes.

public void
applyConverterAnnotations(FacesContext
the javax.faces.context.FacesContext for the current request
ctx
,
Converter<T>
the target Converter to process
c
)

Apply annotations relevant to javax.faces.convert.Converter instances.

public void
applyRendererAnnotations(FacesContext
the javax.faces.context.FacesContext for the current request
ctx
,
Renderer
the Renderer to process
r
,
UIComponent
the UIComponent instances that is associated with this Renderer
c
)

Apply annotations relevent to javax.faces.render.Renderer instances.

public void
public void
applyValidatorAnnotations(FacesContext
the javax.faces.context.FacesContext for the current request
ctx
,
Validator<T>
the target Validator to process
v
)

Apply annotations relevant to javax.faces.validator.Validator instances.

private Map<Class<? extends Annotation>, ConfigAnnotationHandler>

Returns:

a new Map which maps the types of annotations to a specific ConfigAnnotationHandler. Note that each invocation of this method constructs a new Map with new ConfigAnnotationhandler instances as they are not thread safe.
getConfigAnnotationHandlers
()

private Map<Class<? extends Annotation>, RuntimeAnnotationHandler>

Returns:

a Map keyed by Annotation class with an AnnotationHandler as the value
getHandlerMap
(Class<?>
class of the processingTarget
targetClass
,
AnnotationManager.ProcessingTarget
the type of component being processed
processingTarget
)

Helper method to look up cached annotation metadata.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BEHAVIOR_SCANNERSback to summary
private static final Scanner[] BEHAVIOR_SCANNERS

Scanner instances to be used against Behavior classes.

cacheback to summary
private ConcurrentMap<Class<?>, Future<Map<Class<? extends Annotation>, RuntimeAnnotationHandler>>> cache

The backing cache for all annotation metadata.

CLIENT_BEHAVIOR_RENDERER_SCANNERSback to summary
private static final Scanner[] CLIENT_BEHAVIOR_RENDERER_SCANNERS

Scanner instances to be used against ClientBehaviorRenderer classes.

CONVERTER_SCANNERSback to summary
private static final Scanner[] CONVERTER_SCANNERS

Scanner instances to be used against Converter classes.

EVENTS_SCANNERSback to summary
private static final Scanner[] EVENTS_SCANNERS
LISTENER_FOR_SCANNERback to summary
private static final Scanner LISTENER_FOR_SCANNER
LOGGERback to summary
private static final Logger LOGGER
RENDERER_SCANNERSback to summary
private static final Scanner[] RENDERER_SCANNERS

Scanner instances to be used against Renderer classes.

RESOURCE_DEPENDENCY_SCANNERback to summary
private static final Scanner RESOURCE_DEPENDENCY_SCANNER
UICOMPONENT_SCANNERSback to summary
private static final Scanner[] UICOMPONENT_SCANNERS

Scanner instances to be used against UIComponent classes.

VALIDATOR_SCANNERSback to summary
private static final Scanner[] VALIDATOR_SCANNERS

Scanner instances to be used against Validator classes.

Constructor Detail

AnnotationManagerback to summary
public AnnotationManager()

Construct a new AnnotationManager instance.

Method Detail

applyAnnotationsback to summary
private void applyAnnotations(FacesContext ctx, Class<?> targetClass, AnnotationManager.ProcessingTarget processingTarget, Object... params)

Apply all annotations associated with targetClass

Parameters
ctx:FacesContext

the javax.faces.context.FacesContext for the current request

targetClass:Class<?>

class of the processingTarget

processingTarget:AnnotationManager.ProcessingTarget

the type of component that is being processed

params:Object[]

one or more parameters to be passed to each RuntimeAnnotationHandler

applyBehaviorAnnotationsback to summary
public void applyBehaviorAnnotations(FacesContext ctx, Behavior b)

Apply annotations relevant to javax.faces.component.behavior.Behavior instances.

Parameters
ctx:FacesContext

the javax.faces.context.FacesContext for the current request

b:Behavior

the target Behavior to process

applyClientBehaviorRendererAnnotationsback to summary
public void applyClientBehaviorRendererAnnotations(FacesContext ctx, ClientBehaviorRenderer b)

Apply annotations relevant to javax.faces.render.ClientBehaviorRenderer instances.

Parameters
ctx:FacesContext

the javax.faces.context.FacesContext for the current request

b:ClientBehaviorRenderer

the target ClientBehaviorRenderer to process

applyComponentAnnotationsback to summary
public void applyComponentAnnotations(FacesContext ctx, UIComponent c)

Apply annotations relevant to javax.faces.component.UIComponent instances.

Parameters
ctx:FacesContext

the javax.faces.context.FacesContext for the current request

c:UIComponent

the target UIComponent to process

applyConfigAnnotationsback to summary
public void applyConfigAnnotations(FacesContext ctx, Class<? extends Annotation> annotationType, Set<? extends Class<T>> annotatedClasses)

Apply the configuration metadata contained with in the Collection of annotated classes.

Parameters
ctx:FacesContext

FacesContext available during application initialization

annotatedClasses:Set<? extends Class<T>>

Collection of class names known to contain one or more Faces configuration annotations

applyConverterAnnotationsback to summary
public void applyConverterAnnotations(FacesContext ctx, Converter<T> c)

Apply annotations relevant to javax.faces.convert.Converter instances.

Parameters
ctx:FacesContext

the javax.faces.context.FacesContext for the current request

c:Converter<T>

the target Converter to process

applyRendererAnnotationsback to summary
public void applyRendererAnnotations(FacesContext ctx, Renderer r, UIComponent c)

Apply annotations relevent to javax.faces.render.Renderer instances.

Parameters
ctx:FacesContext

the javax.faces.context.FacesContext for the current request

r:Renderer

the Renderer to process

c:UIComponent

the UIComponent instances that is associated with this Renderer

applySystemEventAnnotationsback to summary
public void applySystemEventAnnotations(FacesContext ctx, SystemEvent e)
applyValidatorAnnotationsback to summary
public void applyValidatorAnnotations(FacesContext ctx, Validator<T> v)

Apply annotations relevant to javax.faces.validator.Validator instances.

Parameters
ctx:FacesContext

the javax.faces.context.FacesContext for the current request

v:Validator<T>

the target Validator to process

getConfigAnnotationHandlersback to summary
private Map<Class<? extends Annotation>, ConfigAnnotationHandler> getConfigAnnotationHandlers()
Returns:Map<Class<? extends Annotation>, ConfigAnnotationHandler>

a new Map which maps the types of annotations to a specific ConfigAnnotationHandler. Note that each invocation of this method constructs a new Map with new ConfigAnnotationhandler instances as they are not thread safe.

getHandlerMapback to summary
private Map<Class<? extends Annotation>, RuntimeAnnotationHandler> getHandlerMap(Class<?> targetClass, AnnotationManager.ProcessingTarget processingTarget)

Helper method to look up cached annotation metadata.

Parameters
targetClass:Class<?>

class of the processingTarget

processingTarget:AnnotationManager.ProcessingTarget

the type of component being processed

Returns:Map<Class<? extends Annotation>, RuntimeAnnotationHandler>

a Map keyed by Annotation class with an AnnotationHandler as the value

com.sun.faces.application.annotation back to summary

private final Class AnnotationManager.ProcessAnnotationsTask

extends Object
implements Callable<Map<Class<? extends Annotation>, RuntimeAnnotationHandler>>
Class Inheritance
  • java.lang.Object
  • com.sun.faces.application.annotation.AnnotationManager.ProcessAnnotationsTask
All Implemented Interfaces
java.util.concurrent.Callable

This Callable will leverage the provided Scanners to build a mapping between a particular annotation type and an AnnotationHandler for that type.

Field Summary

Modifier and TypeField and Description
private Class<?>
private static final Map<Class<? extends Annotation>, RuntimeAnnotationHandler>
private Scanner[]

Constructor Summary

AccessConstructor and Description
public
ProcessAnnotationsTask(Class<?> clazz, Scanner[] scanners)

Method Summary

Modifier and TypeMethod and Description
public Map<Class<? extends Annotation>, RuntimeAnnotationHandler>
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clazzback to summary
private Class<?> clazz
EMPTYback to summary
private static final Map<Class<? extends Annotation>, RuntimeAnnotationHandler> EMPTY
Annotations
@SuppressWarnings:unchecked
scannersback to summary
private Scanner[] scanners

Constructor Detail

ProcessAnnotationsTaskback to summary
public ProcessAnnotationsTask(Class<?> clazz, Scanner[] scanners)

Method Detail

callback to summary
public Map<Class<? extends Annotation>, RuntimeAnnotationHandler> call() throws Exception

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:Map<Class<? extends Annotation>, RuntimeAnnotationHandler>

computed result

Annotations
@Override
Exceptions
Exception:
if unable to compute a result
com.sun.faces.application.annotation back to summary

private final Enum AnnotationManager.ProcessingTarget

extends Enum<AnnotationManager.ProcessingTarget>
Class Inheritance

Enum of the different processing targets and their associated Scanners

Field Summary

Modifier and TypeField and Description
public static final AnnotationManager.ProcessingTarget
public static final AnnotationManager.ProcessingTarget
public static final AnnotationManager.ProcessingTarget
public static final AnnotationManager.ProcessingTarget
private Scanner[]
public static final AnnotationManager.ProcessingTarget
public static final AnnotationManager.ProcessingTarget
public static final AnnotationManager.ProcessingTarget

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AnnotationManager.ProcessingTarget
public static AnnotationManager.ProcessingTarget[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Behaviorback to summary
public static final AnnotationManager.ProcessingTarget Behavior
ClientBehaviorRendererback to summary
public static final AnnotationManager.ProcessingTarget ClientBehaviorRenderer
Converterback to summary
public static final AnnotationManager.ProcessingTarget Converter
Rendererback to summary
public static final AnnotationManager.ProcessingTarget Renderer
scannersback to summary
private Scanner[] scanners
Annotations
@SuppressWarnings:NonSerializableFieldInSerializableClass
SystemEventback to summary
public static final AnnotationManager.ProcessingTarget SystemEvent
UIComponentback to summary
public static final AnnotationManager.ProcessingTarget UIComponent
Validatorback to summary
public static final AnnotationManager.ProcessingTarget Validator

Constructor Detail

ProcessingTargetback to summary
private ProcessingTarget(Scanner[] scanners)

Method Detail

valueOfback to summary
public static AnnotationManager.ProcessingTarget valueOf(String name)
valuesback to summary
public static AnnotationManager.ProcessingTarget[] values()