public final class AnnotationDetector extends Object
AnnotationDetector reads Java Class File (".class") files and reports the
encountered annotations via a simple, developer friendly API.
DataInput and DataOutput.
ClassFile {
u4 magic;
u2 minor_version;
u2 major_version;
u2 constant_pool_count;
cp_info constant_pool[constant_pool_count-1];
u2 access_flags;
u2 this_class;
u2 super_class;
u2 interfaces_count;
u2 interfaces[interfaces_count];
u2 fields_count;
field_info fields[fields_count];
u2 methods_count;
method_info methods[methods_count];
u2 attributes_count;
attribute_info attributes[attributes_count];
}
Where:
u1 unsigned byte DataInput.readUnsignedByte()
u2 unsigned short DataInput.readUnsignedShort()
u4 unsigned int DataInput.readInt()
Annotations are stored as Attributes (i.e. "RuntimeVisibleAnnotations" and
"RuntimeInvisibleAnnotations").
References:
tv.cntt:annovention:1.2;| Modifier and Type | Class and Description |
|---|---|
static interface |
AnnotationDetector.FieldReporter |
static interface |
AnnotationDetector.MethodReporter |
static interface |
AnnotationDetector.Reporter
Reporter is the base interface, used to report the detected annotations. |
static interface |
AnnotationDetector.TypeReporter |
| Constructor and Description |
|---|
AnnotationDetector(AnnotationDetector.Reporter reporter)
Create a new
AnnotationDetector, reporting the detected annotations
to the specified Reporter. |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Reclaim memory.
|
void |
detect()
Report all Java ClassFile files available on the class path.
|
void |
detect(File... filesOrDirectories)
Report all Java ClassFile files available available from the specified files
and/or directories, including sub directories.
|
void |
detect(String... packageNames)
Report all Java ClassFile files available available on the class path from
the specified packages and sub packages.
|
public AnnotationDetector(AnnotationDetector.Reporter reporter)
AnnotationDetector, reporting the detected annotations
to the specified Reporter.public final void detect()
throws IOException
IOExceptiondetect(java.io.File...)public final void detect(String... packageNames) throws IOException
IOExceptiondetect(java.io.File...)public final void detect(File... filesOrDirectories) throws IOException
CAFEBABE are silently ignored.IOExceptionpublic void destroy()
Copyright © 2013. All Rights Reserved.