FileDocCategorySizeDatePackage
ClassNode.javaAPI DocGlassfish v2 API6074Thu Mar 02 11:51:14 GMT 2006oracle.toplink.libraries.asm.tree

ClassNode

public class ClassNode extends Object
A node that represents a class.
author
Eric Bruneton

Fields Summary
public int
version
The class version.
public int
access
The class's access flags (see {@link oracle.toplink.libraries.asm.Constants}). This field also indicates if the class is deprecated.
public String
name
The internal name of the class (see {@link oracle.toplink.libraries.asm.Type#getInternalName() getInternalName}).
public String
superName
The internal of name of the super class (see {@link oracle.toplink.libraries.asm.Type#getInternalName() getInternalName}). For interfaces, the super class is {@link Object}. May be null, but only for the {@link Object java.lang.Object} class.
public final List
interfaces
The internal names of the class's interfaces (see {@link oracle.toplink.libraries.asm.Type#getInternalName() getInternalName}). This list is a list of {@link String} objects.
public String
sourceFile
The name of the source file from which this class was compiled. May be null.
public final List
innerClasses
Informations about the inner classes of this class. This list is a list of {@link InnerClassNode InnerClassNode} objects.
public final List
fields
The fields of this class. This list is a list of {@link FieldNode FieldNode} objects.
public final List
methods
The methods of this class. This list is a list of {@link MethodNode MethodNode} objects.
public Attribute
attrs
The non standard attributes of the class.
Constructors Summary
public ClassNode(int version, int access, String name, String superName, String[] interfaces, String sourceFile)
Constructs a new {@link ClassNode ClassNode} object.

param
version the class version.
param
access the class's access flags (see {@link oracle.toplink.libraries.asm.Constants}). This parameter also indicates if the class is deprecated.
param
name the internal name of the class (see {@link oracle.toplink.libraries.asm.Type#getInternalName() getInternalName}).
param
superName the internal of name of the super class (see {@link oracle.toplink.libraries.asm.Type#getInternalName() getInternalName}). For interfaces, the super class is {@link Object}.
param
interfaces the internal names of the class's interfaces (see {@link oracle.toplink.libraries.asm.Type#getInternalName() getInternalName}). May be null.
param
sourceFile the name of the source file from which this class was compiled. May be null.

    this.version = version;
    this.access = access;
    this.name = name;
    this.superName = superName;
    this.interfaces = new ArrayList();
    this.sourceFile = sourceFile;
    this.innerClasses = new ArrayList();
    this.fields = new ArrayList();
    this.methods = new ArrayList();
    if (interfaces != null) {
      this.interfaces.addAll(Arrays.asList(interfaces));
    }
  
Methods Summary
public voidaccept(oracle.toplink.libraries.asm.ClassVisitor cv)
Makes the given class visitor visit this class.

param
cv a class visitor.

    // visits header
    String[] interfaces = new String[this.interfaces.size()];
    this.interfaces.toArray(interfaces);
    cv.visit(version, access, name, superName, interfaces, sourceFile);
    // visits inner classes
    int i;
    for (i = 0; i < innerClasses.size(); ++i) {
      ((InnerClassNode)innerClasses.get(i)).accept(cv);
    }
    // visits fields
    for (i = 0; i < fields.size(); ++i) {
      ((FieldNode)fields.get(i)).accept(cv);
    }
    // visits methods
    for (i = 0; i < methods.size(); ++i) {
      ((MethodNode)methods.get(i)).accept(cv);
    }
    // visits attributes
    Attribute attrs = this.attrs;
    while (attrs != null) {
      cv.visitAttribute(attrs);
      attrs = attrs.next;
    }
    // visits end
    cv.visitEnd();