public class CheckAnnotationAdapter extends AnnotationVisitor
AnnotationVisitor
that checks that its methods are properly used.Modifier and Type | Field and Description |
---|---|
private boolean |
useNamedValue
Whether the values of the visited annotation are named.
|
private boolean |
visitEndCalled
Whether the
visitEnd() method has been called. |
api, av
Constructor and Description |
---|
CheckAnnotationAdapter(AnnotationVisitor annotationVisitor) |
CheckAnnotationAdapter(AnnotationVisitor annotationVisitor,
boolean useNamedValues) |
Modifier and Type | Method and Description |
---|---|
private void |
checkName(java.lang.String name) |
private void |
checkVisitEndNotCalled() |
void |
visit(java.lang.String name,
java.lang.Object value)
Visits a primitive value of the annotation.
|
AnnotationVisitor |
visitAnnotation(java.lang.String name,
java.lang.String descriptor)
Visits a nested annotation value of the annotation.
|
AnnotationVisitor |
visitArray(java.lang.String name)
Visits an array value of the annotation.
|
void |
visitEnd()
Visits the end of the annotation.
|
void |
visitEnum(java.lang.String name,
java.lang.String descriptor,
java.lang.String value)
Visits an enumeration value of the annotation.
|
private final boolean useNamedValue
private boolean visitEndCalled
visitEnd()
method has been called.public CheckAnnotationAdapter(AnnotationVisitor annotationVisitor)
CheckAnnotationAdapter(AnnotationVisitor annotationVisitor, boolean useNamedValues)
public void visit(java.lang.String name, java.lang.Object value)
AnnotationVisitor
visit
in class AnnotationVisitor
name
- the value name.value
- the actual value, whose type must be Byte
, Boolean
, Character
, Short
, Integer
, Long
, Float
, Double
,
String
or Type
of Type.OBJECT
or Type.ARRAY
sort. This
value can also be an array of byte, boolean, short, char, int, long, float or double values
(this is equivalent to using AnnotationVisitor.visitArray(java.lang.String)
and visiting each array element in turn,
but is more convenient).public void visitEnum(java.lang.String name, java.lang.String descriptor, java.lang.String value)
AnnotationVisitor
visitEnum
in class AnnotationVisitor
name
- the value name.descriptor
- the class descriptor of the enumeration class.value
- the actual enumeration value.public AnnotationVisitor visitAnnotation(java.lang.String name, java.lang.String descriptor)
AnnotationVisitor
visitAnnotation
in class AnnotationVisitor
name
- the value name.descriptor
- the class descriptor of the nested annotation class.public AnnotationVisitor visitArray(java.lang.String name)
AnnotationVisitor
visit
. This is what ClassReader
does.visitArray
in class AnnotationVisitor
name
- the value name.public void visitEnd()
AnnotationVisitor
visitEnd
in class AnnotationVisitor
private void checkName(java.lang.String name)
private void checkVisitEndNotCalled()