1 25 26 package org.netbeans.modules.classfile; 27 28 29 34 public class CPMethodInfo extends CPFieldMethodInfo { 35 CPMethodInfo(ConstantPool pool,int iClass,int iNameAndType) { 36 super(pool, iClass, iNameAndType); 37 } 38 39 public final String getMethodName() { 40 return getFieldName(); 41 } 42 43 46 public final String getFullMethodName() { 47 return getFullMethodName(getMethodName(), getDescriptor()); 48 } 49 50 static String getFullMethodName(String name, String signature) { 51 StringBuffer sb = new StringBuffer (); 52 int index = signature.indexOf(')'); 53 String params = signature.substring(1, index); 54 55 if (!"<init>".equals(name) && !"<clinit>".equals(name)) { 56 String ret = signature.substring(index + 1); 57 ret = CPFieldMethodInfo.getSignature(ret, false); 58 if (ret.length() > 0) { 59 sb.append(ret); 60 sb.append(' '); 61 } 62 } 63 sb.append(name); 64 sb.append('('); 65 index = 0; 66 int paramsLength = params.length(); 67 while (index < paramsLength) { 68 StringBuffer p = new StringBuffer (); 69 char ch = params.charAt(index++); 70 while (ch == '[') { 71 p.append(ch); 72 ch = params.charAt(index++); 73 } 74 p.append(ch); 75 if (ch == 'L') 76 do { 77 ch = params.charAt(index++); 78 p.append(ch); 79 } while (ch != ';'); 80 sb.append(CPFieldMethodInfo.getSignature(p.toString(), false)); 81 if (index < paramsLength) 82 sb.append(','); 83 } 84 sb.append(')'); 85 return sb.toString(); 86 } 87 88 public int getTag() { 89 return ConstantPool.CONSTANT_MethodRef; 90 } 91 } 92 | Popular Tags |