|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsoot.jimple.toolkits.annotation.j5anno.AnnotationGenerator
public class AnnotationGenerator
AnnotationGenerator is a singleton class that wraps up Soot's support for Java 5
annotations in a more convenient interface. It supplies three annotate()
methods that take an Host, an annotation class, and zero or more
AnnotationElem objects; these methods find the appropriate Tag
on the given Host for the appropriate annotation visibility and
add an annotation of the given type to it.
Note that the first two methods expect an annotation class, which the last
method expects a class name. If the class is passed, this class has to be on
Soot's classpath at compile time. It is not enough to add the class to
the soo-classpath!
One caveat:
annotate() does not add annotation classes to the Scene, so you will
have to manually add any annotation classes that were not already in the Scene to the
output directory or jar.
Constructor Summary | |
---|---|
AnnotationGenerator(Singletons.Global g)
|
Method Summary | |
---|---|
void |
annotate(Host h,
Class<? extends Annotation> klass,
AnnotationElem... elems)
Applies a Java 1.5-style annotation to a given Host. |
void |
annotate(Host h,
Class<? extends Annotation> klass,
List<AnnotationElem> elems)
Applies a Java 1.5-style annotation to a given Host. |
void |
annotate(Host h,
String annotationName,
int visibility,
List<AnnotationElem> elems)
Applies a Java 1.5-style annotation to a given Host. |
static AnnotationGenerator |
v()
Returns the unique instance of AnnotationGenerator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotationGenerator(Singletons.Global g)
Method Detail |
---|
public static AnnotationGenerator v()
public void annotate(Host h, Class<? extends Annotation> klass, AnnotationElem... elems)
SootClass
, SootMethod
or SootField
.
h
- a method, field, or classklass
- the class of the annotation to apply to h
elems
- a (possibly empty) sequence of AnnotationElem objects corresponding to the elements that should be contained in this annotationpublic void annotate(Host h, Class<? extends Annotation> klass, List<AnnotationElem> elems)
SootClass
, SootMethod
or SootField
.
h
- a method, field, or classklass
- the class of the annotation to apply to h
elems
- a (possibly empty) sequence of AnnotationElem objects corresponding to the elements that should be contained in this annotationpublic void annotate(Host h, String annotationName, int visibility, List<AnnotationElem> elems)
SootClass
, SootMethod
or SootField
.
h
- a method, field, or classannotationName
- the qualified name of the annotation classvisibility
- any of the constants in AnnotationConstants
elems
- a (possibly empty) sequence of AnnotationElem objects corresponding to the elements that should be contained in this annotation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |