1 25 26 package org.netbeans.modules.classfile; 27 28 41 public final class EnclosingMethod { 42 final CPClassInfo classInfo; 43 final CPNameAndTypeInfo methodInfo; 44 45 EnclosingMethod(ConstantPool pool, CPClassInfo classInfo, int iMethod) { 46 this.classInfo = classInfo; 47 methodInfo = iMethod > 0 ? (CPNameAndTypeInfo)pool.get(iMethod) : null; 48 } 49 50 public ClassName getClassName() { 51 return classInfo.getClassName(); 52 } 53 54 57 public CPClassInfo getClassInfo() { 58 return classInfo; 59 } 60 61 67 public boolean hasMethod() { 68 return methodInfo != null; 69 } 70 71 80 public CPNameAndTypeInfo getMethodInfo() { 81 return methodInfo; 82 } 83 84 public String toString() { 85 String methodString = methodInfo != null 86 ? methodInfo.toString() : "<no method>"; 87 return "enclosing method: class=" + getClassName() + ", method=" + methodString; } 90 } 91 | Popular Tags |