ASM Mirror Descriptor
Addition to OW2 ASM library to support generating descriptors and signatures from TypeMirrors/Elements.
Background
The ASM library has classes that can process Java class files through a Visitor style API allowing users to examine or modify any part of a class. The ASM Mirror project adds comparable classes to do the same with TypeMirror and Element instances used during Annotation Processing.
Corresponding Classes
ASM Class | ASM Mirror Class | Description |
---|---|---|
ClassReader | MirrorClassReader | A parser to make a ClassVisitor visit a TypeMirror/Element instance. |
Type | MirrorType | A Java field or method type. |
Additional Classes
The Java spec requires "signatures" for generic descriptors. The ASM library has some internal utilities for generating these. The ASM mirror library provides SignatureMirrorType
to generate generic signatures from TypeMirrors/Elements.
Usage
Usage is the same as for the ASM library except you pass in a TypeMirror element from an annotation processor instead of a class file. ASM Mirror calls a standard ASM ClassVistor E.g.
MirrorClassReader reader = new MirrorClassReader(processingEnv, element);
reader.accept(myClassVisitor); // standard ASM ClassVisitor