|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.webbeans.corespi.scanner.AnnotationDB
public class AnnotationDB
The base of this class has been taken from scannotation which is not actively maintained anymore. Since it has Apache License v2.0, we maintain a bug fixed and highly adoped version on our own.
The class allows you to scan an arbitrary set of "archives" for .class files. These class files are parsed to see what annotations they use. Two indexes are created. The javax, java, sun, com.sun, and javassist packages will not be scanned by default. One is a map of annotations and what classes use those annotations. This could be used, for example, by an EJB deployer to find all the EJBs contained in the archive Another is a mpa of classes and what annotations those classes use.
| Nested Class Summary | |
|---|---|
class |
AnnotationDB.CrossReferenceException
|
| Constructor Summary | |
|---|---|
AnnotationDB()
|
|
| Method Summary | |
|---|---|
void |
addIgnoredPackages(String... ignored)
|
void |
crossReferenceMetaAnnotations()
This method will cross reference annotations in the annotation index with any meta-annotations that they have and create additional entries as needed. |
Map<String,Set<String>> |
getAnnotationIndex()
returns a map keyed by the fully qualified string name of a annotation class. |
Map<String,Set<String>> |
getClassIndex()
returns a map keyed by the list of classes scanned. |
String[] |
getIgnoredPackages()
|
void |
outputAnnotationIndex(PrintWriter writer)
Prints out annotationIndex |
protected void |
populate(javassist.bytecode.annotation.Annotation[] annotations,
String className)
|
void |
scanArchives(String... urls)
Scan a url that represents an "archive" this is a classpath directory or jar file |
protected void |
scanClass(javassist.bytecode.ClassFile cf)
|
void |
scanClass(InputStream bits)
Parse a .class file for annotations |
protected void |
scanFields(javassist.bytecode.ClassFile cf)
|
protected void |
scanMethods(javassist.bytecode.ClassFile cf)
Scanns both the method and its parameters for annotations. |
void |
setIgnoredPackages(String[] ignoredPackages)
Override/overwrite any ignored packages |
void |
setScanClassAnnotations(boolean scanClassAnnotations)
Whether or not you want AnnotationDB to scan for class level annotations |
void |
setScanFieldAnnotations(boolean scanFieldAnnotations)
Whether or not you want AnnotationDB to scan for parameter level annotations |
void |
setScanMethodAnnotations(boolean scanMethodAnnotations)
Wheter or not you want AnnotationDB to scan for method level annotations |
void |
setScanParameterAnnotations(boolean scanParameterAnnotations)
Whether or not you want AnnotationDB to scan for parameter level annotations |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AnnotationDB()
| Method Detail |
|---|
public String[] getIgnoredPackages()
public void setIgnoredPackages(String[] ignoredPackages)
ignoredPackages - cannot be nullpublic void addIgnoredPackages(String... ignored)
public void crossReferenceMetaAnnotations()
throws AnnotationDB.CrossReferenceException
AnnotationDB.CrossReferenceExceptionpublic Map<String,Set<String>> getAnnotationIndex()
public Map<String,Set<String>> getClassIndex()
public void setScanClassAnnotations(boolean scanClassAnnotations)
scanClassAnnotations - public void setScanMethodAnnotations(boolean scanMethodAnnotations)
scanMethodAnnotations - public void setScanParameterAnnotations(boolean scanParameterAnnotations)
scanParameterAnnotations - public void setScanFieldAnnotations(boolean scanFieldAnnotations)
scanFieldAnnotations -
public void scanArchives(String... urls)
throws IOException
urls - variable list of URLs to scan as archives
IOException
public void scanClass(InputStream bits)
throws IOException
bits - input stream pointing to .class file bits
IOExceptionprotected void scanClass(javassist.bytecode.ClassFile cf)
protected void scanMethods(javassist.bytecode.ClassFile cf)
cf - protected void scanFields(javassist.bytecode.ClassFile cf)
protected void populate(javassist.bytecode.annotation.Annotation[] annotations,
String className)
public void outputAnnotationIndex(PrintWriter writer)
writer -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||