Class ClassVisitor
🏭 Constructors
constructor
new ClassVisitor(api: number, cv: null | ClassVisitor= null): ClassVisitorConstructs a new ClassVisitor.
Parameters
- api:
numberthe ASM API version implemented by this visitor. Must be one of ASM4 or ASM5. - cv:
null | ClassVisitorthe class visitor to which this visitor must delegate method calls. May be null.
Return Type
ClassVisitor
Defined in: packages/asm/libs/ClassVisitor.ts:70
🏷️ Properties
api
api: numberThe ASM API version implemented by this visitor. The value of this field must be one of ASM4 or ASM5.
Defined in: packages/asm/libs/ClassVisitor.ts:52
cv
cv: null | ClassVisitorThe class visitor to which this visitor must delegate method calls. May be null.
Defined in: packages/asm/libs/ClassVisitor.ts:58
🔧 Methods
visit
visit(version: number, access: number, name: string, signature: null | string, superName: null | string, interfaces: null | string[]): voidVisits the header of the class.
Parameters
- version:
numberthe class version. - access:
numberthe class's access flags (see Opcodes). This parameter also indicates if the class is deprecated. - name:
stringthe internal name of the class (see [Type#getInternalName() getInternalName]). - signature:
null | stringthe signature of this class. May be <tt>null</tt> if the class is not a generic one, and does not extend or implement generic classes or interfaces. - superName:
null | stringthe internal of name of the super class (see [Type#getInternalName() getInternalName]). For interfaces, the super class is [Object]. May be <tt>null</tt>, but only for the [Object] class. - interfaces:
null | string[]the internal names of the class's interfaces (see [Type#getInternalName() getInternalName]). May be <tt>null</tt>.
Return Type
void
Defined in: packages/asm/libs/ClassVisitor.ts:104
visitAnnotation
visitAnnotation(desc: null | string, visible: boolean): null | AnnotationVisitorVisits an annotation of the class.
Parameters
- desc:
null | stringthe class descriptor of the annotation class. - visible:
boolean<tt>true</tt> if the annotation is visible at runtime.
Return Type
null | AnnotationVisitor
Defined in: packages/asm/libs/ClassVisitor.ts:158
visitAttribute
visitAttribute(attr: Attribute): voidVisits a non standard attribute of the class.
Parameters
- attr:
Attributean attribute.
Return Type
void
Defined in: packages/asm/libs/ClassVisitor.ts:203
visitEnd
visitEnd(): voidVisits the end of the class. This method, which is the last one to be called, is used to inform the visitor that all the fields and methods of the class have been visited.
Return Type
void
Defined in: packages/asm/libs/ClassVisitor.ts:304
visitField
visitField(access: number, name: string, desc: null | string, signature: null | string, value: any): null | FieldVisitorVisits a field of the class.
Parameters
- access:
numberthe field's access flags (see Opcodes). This parameter also indicates if the field is synthetic and/or deprecated. - name:
stringthe field's name. - desc:
null | stringthe field's descriptor (see Type). - signature:
null | stringthe field's signature. May be <tt>null</tt> if the field's type does not use generic types. - value:
anythe field's initial value. This parameter, which may be <tt>null</tt> if the field does not have an initial value, must be an [Integer], a [Float], a [Long], a [Double] or a [String] (for <tt>int</tt>, <tt>float</tt>, <tt>long</tt> or <tt>String</tt> fields respectively). <i>This parameter is only used for static fields</i>. Its value is ignored for non static fields, which must be initialized through bytecode instructions in constructors or methods.
Return Type
null | FieldVisitor
Defined in: packages/asm/libs/ClassVisitor.ts:260
visitInnerClass
visitInnerClass(name: string, outerName: string, innerName: null | string, access: number): voidVisits information about an inner class. This inner class is not necessarily a member of the class being visited.
Parameters
- name:
stringthe internal name of an inner class (see [Type#getInternalName() getInternalName]). - outerName:
stringthe internal name of the class to which the inner class belongs (see [Type#getInternalName() getInternalName]). May be <tt>null</tt> for not member classes. - innerName:
null | stringthe (simple) name of the inner class inside its enclosing class. May be <tt>null</tt> for anonymous inner classes. - access:
numberthe access flags of the inner class as originally declared in the enclosing class.
Return Type
void
Defined in: packages/asm/libs/ClassVisitor.ts:227
visitMethod
visitMethod(access: number, name: string, desc: string, signature: null | string, exceptions: null | string[]): null | MethodVisitorVisits a method of the class. This method <i>must</i> return a new MethodVisitor instance (or <tt>null</tt>) each time it is called, i.e., it should not return a previously returned visitor.
Parameters
- access:
numberthe method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated. - name:
stringthe method's name. - desc:
stringthe method's descriptor (see Type). - signature:
null | stringthe method's signature. May be <tt>null</tt> if the method parameters, return type and exceptions do not use generic types. - exceptions:
null | string[]the internal names of the method's exception classes (see [Type#getInternalName() getInternalName]). May be <tt>null</tt>.
Return Type
null | MethodVisitor
Defined in: packages/asm/libs/ClassVisitor.ts:292
visitOuterClass
visitOuterClass(owner: string, name: null | string, desc: null | string): voidVisits the enclosing class of the class. This method must be called only if the class has an enclosing class.
Parameters
- owner:
stringinternal name of the enclosing class of the class. - name:
null | stringthe name of the method that contains the class, or <tt>null</tt> if the class is not enclosed in a method of its enclosing class. - desc:
null | stringthe descriptor of the method that contains the class, or <tt>null</tt> if the class is not enclosed in a method of its enclosing class.
Return Type
void
Defined in: packages/asm/libs/ClassVisitor.ts:142
visitSource
visitSource(source: null | string, debug: null | string): voidVisits the source of the class.
Parameters
- source:
null | stringthe name of the source file from which the class was compiled. May be <tt>null</tt>. - debug:
null | stringadditional debug information to compute the correspondance between source and compiled elements of the class. May be <tt>null</tt>.
Return Type
void
Defined in: packages/asm/libs/ClassVisitor.ts:121
visitTypeAnnotation
visitTypeAnnotation(typeRef: number, typePath: null | TypePath, desc: null | string, visible: boolean): null | AnnotationVisitorVisits an annotation on a type in the class signature.
Parameters
- typeRef:
numbera reference to the annotated type. The sort of this type reference must be [TypeReference#CLASS_TYPE_PARAMETER CLASS_TYPE_PARAMETER], [TypeReference#CLASS_TYPE_PARAMETER_BOUND CLASS_TYPE_PARAMETER_BOUND] or [TypeReference#CLASS_EXTENDS CLASS_EXTENDS]. See TypeReference. - typePath:
null | TypePaththe path to the annotated type argument, wildcard bound, array element type, or static inner type within 'typeRef'. May be <tt>null</tt> if the annotation targets 'typeRef' as a whole. - desc:
null | stringthe class descriptor of the annotation class. - visible:
boolean<tt>true</tt> if the annotation is visible at runtime.
Return Type
null | AnnotationVisitor
Defined in: packages/asm/libs/ClassVisitor.ts:187