Skip to content

Class ClassVisitor

🏭 Constructors

constructor public

ts
new ClassVisitor(api: number, cv: null | ClassVisitor= null): ClassVisitor

Constructs a new ClassVisitor.

Parameters

  • api: number the ASM API version implemented by this visitor. Must be one of ASM4 or ASM5.
  • cv: null | ClassVisitor the 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

ts
api: number

The 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

ts
cv: null | ClassVisitor

The class visitor to which this visitor must delegate method calls. May be null.

Defined in: packages/asm/libs/ClassVisitor.ts:58

🔧 Methods

visit public

ts
visit(version: number, access: number, name: string, signature: null | string, superName: null | string, interfaces: null | string[]): void

Visits the header of the class.

Parameters

  • version: number the class version.
  • access: number the class's access flags (see Opcodes). This parameter also indicates if the class is deprecated.
  • name: string the internal name of the class (see [Type#getInternalName() getInternalName]).
  • signature: null | string the 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 | string the 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 public

ts
visitAnnotation(desc: null | string, visible: boolean): null | AnnotationVisitor

Visits an annotation of the class.

Parameters

  • desc: null | string the 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 public

ts
visitAttribute(attr: Attribute): void

Visits a non standard attribute of the class.

Parameters

  • attr: Attribute an attribute.

Return Type

  • void

Defined in: packages/asm/libs/ClassVisitor.ts:203

visitEnd public

ts
visitEnd(): void

Visits 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 public

ts
visitField(access: number, name: string, desc: null | string, signature: null | string, value: any): null | FieldVisitor

Visits a field of the class.

Parameters

  • access: number the field's access flags (see Opcodes). This parameter also indicates if the field is synthetic and/or deprecated.
  • name: string the field's name.
  • desc: null | string the field's descriptor (see Type).
  • signature: null | string the field's signature. May be <tt>null</tt> if the field's type does not use generic types.
  • value: any the 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 public

ts
visitInnerClass(name: string, outerName: string, innerName: null | string, access: number): void

Visits information about an inner class. This inner class is not necessarily a member of the class being visited.

Parameters

  • name: string the internal name of an inner class (see [Type#getInternalName() getInternalName]).
  • outerName: string the 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 | string the (simple) name of the inner class inside its enclosing class. May be <tt>null</tt> for anonymous inner classes.
  • access: number the 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 public

ts
visitMethod(access: number, name: string, desc: string, signature: null | string, exceptions: null | string[]): null | MethodVisitor

Visits 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: number the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.
  • name: string the method's name.
  • desc: string the method's descriptor (see Type).
  • signature: null | string the 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 public

ts
visitOuterClass(owner: string, name: null | string, desc: null | string): void

Visits the enclosing class of the class. This method must be called only if the class has an enclosing class.

Parameters

  • owner: string internal name of the enclosing class of the class.
  • name: null | string the 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 | string the 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 public

ts
visitSource(source: null | string, debug: null | string): void

Visits the source of the class.

Parameters

  • source: null | string the name of the source file from which the class was compiled. May be <tt>null</tt>.
  • debug: null | string additional 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 public

ts
visitTypeAnnotation(typeRef: number, typePath: null | TypePath, desc: null | string, visible: boolean): null | AnnotationVisitor

Visits an annotation on a type in the class signature.

Parameters

  • typeRef: number a 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 | TypePath the 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 | string the 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