FileDocCategorySizeDatePackage
ASMClassFile.javaAPI DocGlassfish v2 API7852Fri May 04 22:33:24 BST 2007com.sun.enterprise.tools.verifier.apiscan.classfile

ASMClassFile

public class ASMClassFile extends Object implements ClassFile
author
Sanjeeb.Sahoo@Sun.COM

Fields Summary
private static Logger
logger
private String
externalName
private String
internalName
private String
packageName
private com.sun.corba.ee.org.objectweb.asm.ClassReader
cr
private Set
methods
private String
internalNameOfSuperClass
private String[]
internalNamesOfInterfaces
private int
access
Constructors Summary
public ASMClassFile(InputStream is)

        cr = new ClassReader(is);
        cr.accept(new MyVisitor(this), true);
        is.close();
    
Methods Summary
public static java.lang.StringdecodeAccessFlag(int access)

        StringBuilder result = new StringBuilder("");
        if ((access & ACC_PRIVATE) == ACC_PRIVATE) {
            result.append("private "); // NOI18N
        } else if ((access & ACC_PROTECTED) == ACC_PROTECTED) {
            result.append("protected "); // NOI18N
        } else if ((access & ACC_PUBLIC) == ACC_PUBLIC) {
            result.append("public "); // NOI18N
        }
        if ((access & ACC_ABSTRACT) == ACC_ABSTRACT) {
            result.append("abstract "); // NOI18N
        } else if ((access & ACC_FINAL) == ACC_FINAL) {
            result.append("final "); // NOI18N
        }
        if ((access & ACC_INTERFACE) == ACC_INTERFACE) {
            result.append("interface "); // NOI18N
        } else {
            result.append("class "); // NOI18N
        }
        return result.toString();
    
public java.util.CollectiongetAllReferencedClassNames()

        throw new UnsupportedOperationException();
    
public java.util.CollectiongetAllReferencedClassNamesInInternalForm()

        throw new UnsupportedOperationException();
    
public java.lang.StringgetInternalName()

        return internalName;
    
public java.lang.StringgetInternalNameOfSuperClass()

        return internalNameOfSuperClass;
    
public java.lang.String[]getInternalNamesOfInterfaces()

        return internalNamesOfInterfaces;
    
public MethodgetMethod(MethodRef methodRef)

        for (Method m : methods) {
            if (m.getName().equals(methodRef.getName()) &&
                    m.getDescriptor().equals(methodRef.getDescriptor())) {
                return m;
            }
        }
        return null;
    
public java.util.CollectiongetMethods()

        return methods;
    
public java.lang.StringgetName()

        return externalName;
    
public java.lang.StringgetNameOfSuperClass()

        return Util.convertToExternalClassName(internalNameOfSuperClass);
    
public java.lang.String[]getNamesOfInterfaces()

        String[] result = new String[internalNamesOfInterfaces.length];
        for(int i = 0; i< internalNamesOfInterfaces.length; ++i){
            result[i] = Util.convertToExternalClassName(internalNamesOfInterfaces[i]);
        }
        return result;
    
public java.lang.StringgetPackageName()

        return packageName;
    
public booleanisInterface()


       
        return (access & ACC_INTERFACE) == ACC_INTERFACE;
    
public java.lang.StringtoString()

        StringBuilder sb = new StringBuilder(decodeAccessFlag(access)+ externalName);
        if(internalNameOfSuperClass!=null) sb.append(" extends "+getNameOfSuperClass()); // NOI18N
        if(internalNamesOfInterfaces.length>0){
            sb.append(" implements "); // NOI18N
            for(String s : getNamesOfInterfaces()) sb.append(s);
        }
        sb.append("{\n"); // NOI18N
        for(Method m : methods){
            sb.append(m).append("\n"); // NOI18N
        }
        sb.append("}"); // NOI18N
        return sb.toString();