Package eu.bandm.tools.util2
Class AnnotationVisitor<D>
java.lang.Object
eu.bandm.tools.util2.ClassFileVisitor<D>
eu.bandm.tools.util2.AnnotationVisitor<D>
- All Implemented Interfaces:
Runnable
Visits the bytecode of a class and collects annotations.
Warning: not all aspects of annotations are implemented.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
(package private) static @interface
static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected AnnotationVisitor.Annotation
protected final List<AnnotationVisitor.Annotation>
protected final Stack<Consumer<AnnotationVisitor.ElementValue>>
protected boolean
Fields inherited from class eu.bandm.tools.util2.ClassFileVisitor
MAX_MAJOR, MAX_MINOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Pattern<AnnotationVisitor.Annotation>
annotation
(Pattern<String> name, Pattern<Map<String, AnnotationVisitor.ElementValue>> params) protected void
constantClass
(int index, int nameIndex) protected void
elementValueString
(int valueIndex) protected void
protected void
protected void
protected void
protected String
getClassName
(int typeIndex) static void
param
(Pattern<String> name, Pattern<AnnotationVisitor.ElementValue> value) param
(String name, Pattern<AnnotationVisitor.ElementValue> value) protected void
startAnnotation
(int typeIndex, int length) protected void
startClass
(int accessFlags, int thisClass, int superClass, int... interfaces) protected void
startElementValueArray
(int length) protected void
startElementValuePair
(int index, int nameIndex) protected String
unmangleClassName
(String fieldDescriptor) Methods inherited from class eu.bandm.tools.util2.ClassFileVisitor
attribute, constantDouble, constantFieldref, constantFloat, constantInteger, constantInterfaceMethodref, constantInvokeDynamic, constantLong, constantMethodHandle, constantMethodref, constantMethodType, constantModule, constantNameAndType, constantPackage, constantString, constantUtf8, constantValue, elementValueBoolean, elementValueByte, elementValueChar, elementValueClass, elementValueDouble, elementValueEnum, elementValueFloat, elementValueInt, elementValueLong, elementValueShort, endAttributes, endClass, endClassFile, endCode, endConstantPool, endElementValueAnnotation, endExceptionHandlers, endField, endFields, endInnerClasses, endLineNumberTable, endMethod, endRuntimeInvisibleAnnotations, endRuntimeVisibleAnnotations, exceptionHandler, exceptions, getMessageReceiver, getUTF8, innerClass, lineNumber, run, setMessageReceiver, sourceFile, startAttributes, startClassFile, startCode, startConstantPool, startElementValueAnnotation, startExceptionHandlers, startField, startFields, startInnerClasses, startLineNumberTable, startMethod, startMethods, startRuntimeInvisibleAnnotations, startRuntimeVisibleAnnotations, visitAnnotation, visitAttribute, visitAttributes, visitClass, visitClassFile, visitCodeAttribute, visitConstantClass, visitConstantDouble, visitConstantFieldref, visitConstantFloat, visitConstantInteger, visitConstantInterfaceMethodref, visitConstantInvokeDynamic, visitConstantLong, visitConstantMethodHandle, visitConstantMethodref, visitConstantMethodType, visitConstantModule, visitConstantNameAndType, visitConstantPackage, visitConstantPool, visitConstantPoolEntry, visitConstantString, visitConstantUtf8, visitConstantValueAttribute, visitElementValue, visitElementValuePair, visitExceptionsAttribute, visitExceptionTable, visitField, visitFields, visitInnerClassesAttribute, visitInterfaces, visitLineNumberTableAttribute, visitMethod, visitMethods, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitSourceFileAttribute
-
Field Details
-
classNames
-
forClass
protected boolean forClass -
annotation
-
elementValueConsumer
-
classAnnotations
-
-
Constructor Details
-
AnnotationVisitor
-
-
Method Details
-
getClassAnnotations
-
getClassName
-
unmangleClassName
-
constantClass
protected void constantClass(int index, int nameIndex) - Overrides:
constantClass
in classClassFileVisitor<D>
-
startClass
protected void startClass(int accessFlags, int thisClass, int superClass, int... interfaces) - Overrides:
startClass
in classClassFileVisitor<D>
-
endMethods
protected void endMethods()- Overrides:
endMethods
in classClassFileVisitor<D>
-
startAnnotation
protected void startAnnotation(int typeIndex, int length) - Overrides:
startAnnotation
in classClassFileVisitor<D>
-
endAnnotation
protected void endAnnotation()- Overrides:
endAnnotation
in classClassFileVisitor<D>
-
startElementValuePair
protected void startElementValuePair(int index, int nameIndex) - Overrides:
startElementValuePair
in classClassFileVisitor<D>
-
endElementValuePair
protected void endElementValuePair()- Overrides:
endElementValuePair
in classClassFileVisitor<D>
-
elementValueString
protected void elementValueString(int valueIndex) - Overrides:
elementValueString
in classClassFileVisitor<D>
-
startElementValueArray
protected void startElementValueArray(int length) - Overrides:
startElementValueArray
in classClassFileVisitor<D>
-
endElementValueArray
protected void endElementValueArray()- Overrides:
endElementValueArray
in classClassFileVisitor<D>
-
annotation
public static Pattern<AnnotationVisitor.Annotation> annotation(Pattern<String> name, Pattern<Map<String, AnnotationVisitor.ElementValue>> params) -
param
public static Pattern<Map.Entry<String,AnnotationVisitor.ElementValue>> param(Pattern<String> name, Pattern<AnnotationVisitor.ElementValue> value) -
param
public static Pattern<Map.Entry<String,AnnotationVisitor.ElementValue>> param(String name, Pattern<AnnotationVisitor.ElementValue> value) -
main
- Throws:
Exception
-