What are AnnotationVisitor and SignatureVisitor?
This article mainly explains "what is AnnotationVisitor and SignatureVisitor". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is AnnotationVisitor and SignatureVisitor".
Brief introduction
AnnotationVisitor is used to access Annotation, and SignatureVisitor is used to access signatures.
AnnotationVisitor
The order of AnnotationVisitor access is as follows:
(visit | visitEnum | visitAnnotation | code visitArray) * visitEnd.
() * can be accessed multiple times, but visitEnd can only be accessed once
Visit: access the basic values of annotations
VisitEnum: access the enumerated type values of annotations
VisitAnnotation: access nested annotation types, that is, one annotation may be annotated by other annotations
VisitArray: access the array values of annotations
VisitEnd: end of access notification
SignatureVisitor
SignatureVisitor is used to access generic types in the following order:
Class signature ClassSignature: (visitFormalTypeParameter visitClassBound?
VisitInterfaceBound*) * (visitSuperclass visitInterface*)
Method signature MethodSignature: (visitFormalTypeParameter visitClassBound?
VisitInterfaceBound*) * (visitParameterType* visitReturnType visitExceptionType*)
Domain signature FieldSignature: visitBaseType | visitTypeVariable | visitArrayType | (visitClassType visitTypeArgument* (visitInnerClassType visitTypeArgument*) * visitEnd))
VisitFormalTypeParameter (final String name): access to regular type parameters
VisitClassBound: access to the class bounds of the last accessed regular type parameter
VisitInterfaceBound: interface bounds for accessing the last accessed regular type parameter
VisitSuperclass: access the superclass of this type
VisitInterface: access the interface implemented by this class
VisitParameterType: access method parameter type
VisitReturnType: the type of value returned by the access method
VisitExceptionType: access method exception type
VisitBaseType: access to basic types of signatures
VisitTypeVariable: access the signature of a type variable
VisitArrayType: access a signature of an array type
VisitClassType: start to access the signature of a class or interface type
VisitInnerClassType: access inner classes
VisitTypeArgument: access the unbounded type parameter of the last accessed class or interface
VisitTypeArgument (final char wildcard): access the type parameters of the last accessed class or inner class
VisitEnd: end of access notification
Thank you for your reading, the above is the content of "what is AnnotationVisitor and SignatureVisitor". After the study of this article, I believe you have a deeper understanding of what is AnnotationVisitor and SignatureVisitor, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!