1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 37 public class MethodRef_info extends FeatureRef_info { 38 public MethodRef_info(ConstantPool constantPool, DataInputStream in) throws IOException { 39 super(constantPool, in); 40 } 41 42 public boolean isConstructor() { 43 return getRawNameAndType().getName().equals("<init>"); 44 } 45 46 public boolean isStaticInitializer() { 47 return getRawNameAndType().getName().equals("<clinit>"); 48 } 49 50 public String getName() { 51 String result = null; 52 53 if (isConstructor()) { 54 result = getClassName().substring(getClassName().lastIndexOf(".") + 1); 55 } else if (isStaticInitializer()) { 56 result = "static {}"; 57 } else { 58 result = getRawNameAndType().getName(); 59 } 60 61 return result; 62 } 63 64 public String getSignature() { 65 StringBuffer result = new StringBuffer (); 66 67 result.append(getName()); 68 if (!isStaticInitializer()) { 69 result.append(SignatureHelper.getSignature(getRawNameAndType().getType())); 70 } 71 72 return result.toString(); 73 } 74 75 public void accept(Visitor visitor) { 76 visitor.visitMethodRef_info(this); 77 } 78 } 79 | Popular Tags |