public class AnnotationManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
AnnotationManager.ProcessAnnotationsTask
This
Callable will leverage the provided Scanner s
to build a mapping between a particular annotation type and an
AnnotationHandler for that type. |
private static class |
AnnotationManager.ProcessingTarget
Enum of the different processing targets and their associated
Scanner s |
Modifier and Type | Field and Description |
---|---|
private static Scanner[] |
BEHAVIOR_SCANNERS
Scanner instances to be used against Behavior classes. |
private java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.util.concurrent.Future<java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,RuntimeAnnotationHandler>>> |
cache
The backing cache for all annotation metadata.
|
private static Scanner[] |
CLIENT_BEHAVIOR_RENDERER_SCANNERS
Scanner instances to be used against ClientBehaviorRenderer classes. |
private static Scanner[] |
CONVERTER_SCANNERS
Scanner instances to be used against Converter classes. |
private static Scanner[] |
EVENTS_SCANNERS |
private static Scanner |
LISTENER_FOR_SCANNER |
private static java.util.logging.Logger |
LOGGER |
private static Scanner[] |
RENDERER_SCANNERS
Scanner instances to be used against Renderer classes. |
private static Scanner |
RESOURCE_DEPENDENCY_SCANNER |
private static Scanner[] |
UICOMPONENT_SCANNERS
Scanner instances to be used against UIComponent classes. |
private static Scanner[] |
VALIDATOR_SCANNERS
Scanner instances to be used against Validator classes. |
Constructor and Description |
---|
AnnotationManager()
Construct a new AnnotationManager instance.
|
Modifier and Type | Method and Description |
---|---|
private void |
applyAnnotations(javax.faces.context.FacesContext ctx,
java.lang.Class<?> targetClass,
AnnotationManager.ProcessingTarget processingTarget,
java.lang.Object... params)
Apply all annotations associated with
targetClass |
void |
applyBehaviorAnnotations(javax.faces.context.FacesContext ctx,
javax.faces.component.behavior.Behavior b)
Apply annotations relevant to
Behavior instances. |
void |
applyClientBehaviorRendererAnnotations(javax.faces.context.FacesContext ctx,
javax.faces.render.ClientBehaviorRenderer b)
Apply annotations relevant to
ClientBehaviorRenderer instances. |
void |
applyComponentAnnotations(javax.faces.context.FacesContext ctx,
javax.faces.component.UIComponent c)
Apply annotations relevant to
UIComponent instances. |
void |
applyConfigAnnotations(javax.faces.context.FacesContext ctx,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
java.util.Set<? extends java.lang.Class> annotatedClasses)
Apply the configuration metadata contained with in the
Collection
of annotated classes. |
void |
applyConverterAnnotations(javax.faces.context.FacesContext ctx,
javax.faces.convert.Converter c)
Apply annotations relevant to
Converter instances. |
void |
applyRendererAnnotations(javax.faces.context.FacesContext ctx,
javax.faces.render.Renderer r,
javax.faces.component.UIComponent c)
Apply annotations relevent to
Renderer instances. |
void |
applySystemEventAnnotations(javax.faces.context.FacesContext ctx,
javax.faces.event.SystemEvent e) |
void |
applyValidatorAnnotations(javax.faces.context.FacesContext ctx,
javax.faces.validator.Validator v)
Apply annotations relevant to
Validator instances. |
private java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,ConfigAnnotationHandler> |
getConfigAnnotationHandlers() |
private java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,RuntimeAnnotationHandler> |
getHandlerMap(java.lang.Class<?> targetClass,
AnnotationManager.ProcessingTarget processingTarget)
Helper method to look up cached annotation metadata.
|
private static final java.util.logging.Logger LOGGER
private static final Scanner RESOURCE_DEPENDENCY_SCANNER
private static final Scanner LISTENER_FOR_SCANNER
private static final Scanner[] BEHAVIOR_SCANNERS
Scanner
instances to be used against Behavior
classes.private static final Scanner[] CLIENT_BEHAVIOR_RENDERER_SCANNERS
Scanner
instances to be used against ClientBehaviorRenderer
classes.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.private static final Scanner[] CONVERTER_SCANNERS
Scanner
instances to be used against Converter
classes.private static final Scanner[] RENDERER_SCANNERS
Scanner
instances to be used against Renderer
classes.private static final Scanner[] EVENTS_SCANNERS
private java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.util.concurrent.Future<java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,RuntimeAnnotationHandler>>> cache
public AnnotationManager()
public void applyConfigAnnotations(javax.faces.context.FacesContext ctx, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.util.Set<? extends java.lang.Class> annotatedClasses)
Apply the configuration metadata contained with in the Collection
of annotated classes.
ctx
- FacesContext available during application initializationannotatedClasses
- Collection
of class names known
to contain one or more Faces configuration annotationspublic void applyBehaviorAnnotations(javax.faces.context.FacesContext ctx, javax.faces.component.behavior.Behavior b)
Behavior
instances.ctx
- the FacesContext
for the current requestb
- the target Behavior
to processpublic void applyClientBehaviorRendererAnnotations(javax.faces.context.FacesContext ctx, javax.faces.render.ClientBehaviorRenderer b)
ClientBehaviorRenderer
instances.ctx
- the FacesContext
for the current requestb
- the target ClientBehaviorRenderer
to processpublic void applyComponentAnnotations(javax.faces.context.FacesContext ctx, javax.faces.component.UIComponent c)
UIComponent
instances.ctx
- the FacesContext
for the current requestc
- the target UIComponent
to processpublic void applyValidatorAnnotations(javax.faces.context.FacesContext ctx, javax.faces.validator.Validator v)
Validator
instances.ctx
- the FacesContext
for the current requestv
- the target Validator
to processpublic void applyConverterAnnotations(javax.faces.context.FacesContext ctx, javax.faces.convert.Converter c)
Converter
instances.ctx
- the FacesContext
for the current requestc
- the target Converter
to processpublic void applyRendererAnnotations(javax.faces.context.FacesContext ctx, javax.faces.render.Renderer r, javax.faces.component.UIComponent c)
Renderer
instances.ctx
- the FacesContext
for the current requestr
- the Renderer
to processc
- the UIComponent
instances that is associated with this
Renderer
public void applySystemEventAnnotations(javax.faces.context.FacesContext ctx, javax.faces.event.SystemEvent e)
private java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,ConfigAnnotationHandler> getConfigAnnotationHandlers()
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.private void applyAnnotations(javax.faces.context.FacesContext ctx, java.lang.Class<?> targetClass, AnnotationManager.ProcessingTarget processingTarget, java.lang.Object... params)
targetClass
ctx
- the FacesContext
for the current requesttargetClass
- class of the processingTarget
processingTarget
- the type of component that is being processedparams
- one or more parameters to be passed to each RuntimeAnnotationHandler
private java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,RuntimeAnnotationHandler> getHandlerMap(java.lang.Class<?> targetClass, AnnotationManager.ProcessingTarget processingTarget)
targetClass
- class of the processingTarget
processingTarget
- the type of component being processedCopyright © 2002-2013 Oracle America, Inc. All Rights Reserved.