com.sun.faces.config
public class JavaClassScanningAnnotationScanner extends AnnotationScanner
Modifier and Type | Class and Description |
---|---|
private static class |
JavaClassScanningAnnotationScanner.ClassFile
This class is encapsulating binary .class file information as defined at
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html
This is used by the annotation frameworks to quickly scan .class files
for the presence of annotations.
|
private static class |
JavaClassScanningAnnotationScanner.ConstantPoolInfo |
Modifier and Type | Field and Description |
---|---|
private JavaClassScanningAnnotationScanner.ClassFile |
classFileScanner |
private static java.util.regex.Pattern |
JAR_PATTERN |
private static java.util.logging.Logger |
LOGGER |
private static java.lang.String |
WEB_INF_CLASSES |
FACES_ANNOTATION_TYPE, FACES_ANNOTATIONS
sc
Constructor and Description |
---|
JavaClassScanningAnnotationScanner(javax.servlet.ServletContext sc)
Creates a new
AnnotationScanner instance. |
Modifier and Type | Method and Description |
---|---|
private boolean |
containsAnnotation(javax.servlet.ServletContext sc,
java.lang.String pathElement) |
private java.lang.String |
convertToClassName(java.lang.String pathEntry)
Utility method for converting paths to fully qualified class names.
|
private java.lang.String |
convertToClassName(java.lang.String prefix,
java.lang.String pathEntry)
Utility method for converting paths to fully qualified class names.
|
java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.Set<java.lang.Class<?>>> |
getAnnotatedClasses(java.util.Set<java.net.URI> uris) |
private static boolean |
isAnnotation(java.lang.String value)
Called by
JavaClassScanningAnnotationScanner.ConstantPoolInfo when processing the bytes of the
class file. |
private void |
processClasspath(java.util.Set<java.net.URI> uris,
java.util.Set<java.lang.String> classList)
Scans for annotations on classes within JAR files on the classpath.
|
private void |
processJarEntries(java.util.jar.JarFile jarFile,
java.lang.String[] allowedPackages,
java.util.Set<java.lang.String> classList)
Process the entries in the provided
JarFile looking for
class files that may be annotated with any of the Faces configuration
annotations. |
private void |
processWebInfClasses(javax.servlet.ServletContext sc,
java.util.Set<java.lang.String> classList)
Scan
WEB-INF/classes for classes that may be annotated
with any of the Faces configuration annotations. |
private void |
processWebInfClasses(javax.servlet.ServletContext sc,
java.util.Set<java.lang.String> paths,
java.util.Set<java.lang.String> classList)
Scan
WEB-INF/classes for classes that may be annotated
with any of the Faces configuration annotations. |
private void |
processWebInfClasses(javax.servlet.ServletContext sc,
java.lang.String path,
java.util.Set<java.lang.String> classList)
Scan
WEB-INF/classes for classes that may be annotated
with any of the Faces configuration annotations. |
getClasspathPackages, getWebInfClassesPackages, isAnnotationScanPackagesSet, processClass, processClass, processClassList, processJar, processScripts
private static final java.util.logging.Logger LOGGER
private static final java.util.regex.Pattern JAR_PATTERN
private static final java.lang.String WEB_INF_CLASSES
private JavaClassScanningAnnotationScanner.ClassFile classFileScanner
public JavaClassScanningAnnotationScanner(javax.servlet.ServletContext sc)
AnnotationScanner
instance.sc
- the ServletContext
for the application to be
scannedpublic java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.util.Set<java.lang.Class<?>>> getAnnotatedClasses(java.util.Set<java.net.URI> uris)
getAnnotatedClasses
in class AnnotationProvider
uris
- a Set
of URLs that refer to specific faces-config.xml
documents on the classpath. The information returned by the map may
return annotation information from sources outside of those defined by the
urls.Map
of classes mapped to a specific annotation type.
If no annotations are present, or the application is considered
metadata-complete
null
will be returned.private void processClasspath(java.util.Set<java.net.URI> uris, java.util.Set<java.lang.String> classList)
uris
- to a faces-config documents that allow us to refer to
unique jar files on the classpathclassList
- the Set
to which annotated classes
will be addedprivate static boolean isAnnotation(java.lang.String value)
JavaClassScanningAnnotationScanner.ConstantPoolInfo
when processing the bytes of the
class file.value
- the String value as provided from JavaClassScanningAnnotationScanner.ConstantPoolInfo
true
if the value is one of the known
Faces annotations, otherwise false
private void processJarEntries(java.util.jar.JarFile jarFile, java.lang.String[] allowedPackages, java.util.Set<java.lang.String> classList)
JarFile
looking for
class files that may be annotated with any of the Faces configuration
annotations.jarFile
- the JAR to processallowedPackages
- the packages that should be scanned within the jarclassList
- the Set
to which annotated classes
will be addedprivate void processWebInfClasses(javax.servlet.ServletContext sc, java.util.Set<java.lang.String> classList)
WEB-INF/classes
for classes that may be annotated
with any of the Faces configuration annotations.sc
- the ServletContext
for the application being
scannedclassList
- the Set
to which annotated classes
will be addedprivate void processWebInfClasses(javax.servlet.ServletContext sc, java.lang.String path, java.util.Set<java.lang.String> classList)
WEB-INF/classes
for classes that may be annotated
with any of the Faces configuration annotations.sc
- the ServletContext
for the application being
scannedpath
- the path to start the scan fromclassList
- the Set
to which annotated classes
will be addedprivate void processWebInfClasses(javax.servlet.ServletContext sc, java.util.Set<java.lang.String> paths, java.util.Set<java.lang.String> classList)
WEB-INF/classes
for classes that may be annotated
with any of the Faces configuration annotations.sc
- the ServletContext
for the application being
scannedpaths
- a set of paths to processclassList
- the Set
to which annotated classes
will be addedprivate boolean containsAnnotation(javax.servlet.ServletContext sc, java.lang.String pathElement)
sc
- the ServletContext
for the application being
scannedpathElement
- the full path to the classfile to be scannedtrue
if the class contains one of the Faces
configuration annotationsprivate java.lang.String convertToClassName(java.lang.String pathEntry)
pathEntry
- a path entry to a class fileprivate java.lang.String convertToClassName(java.lang.String prefix, java.lang.String pathEntry)
prefix
- the prefix that should be stripped from the class name
before converting itpathEntry
- a path to a class fileCopyright © 2002-2010 Oracle America, Inc. All Rights Reserved.