1 18 package org.apache.tools.ant.taskdefs.optional.depend.constantpool; 19 20 import java.io.DataInputStream ; 21 import java.io.IOException ; 22 23 27 public class InterfaceMethodRefCPInfo extends ConstantPoolEntry { 28 29 private String interfaceMethodClassName; 30 31 private String interfaceMethodName; 32 33 private String interfaceMethodType; 34 38 private int classIndex; 39 43 private int nameAndTypeIndex; 44 45 46 public InterfaceMethodRefCPInfo() { 47 super(CONSTANT_INTERFACEMETHODREF, 1); 48 } 49 50 58 public void read(DataInputStream cpStream) throws IOException { 59 classIndex = cpStream.readUnsignedShort(); 60 nameAndTypeIndex = cpStream.readUnsignedShort(); 61 } 62 63 70 public void resolve(ConstantPool constantPool) { 71 ClassCPInfo interfaceMethodClass 72 = (ClassCPInfo) constantPool.getEntry(classIndex); 73 74 interfaceMethodClass.resolve(constantPool); 75 76 interfaceMethodClassName = interfaceMethodClass.getClassName(); 77 78 NameAndTypeCPInfo nt 79 = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex); 80 81 nt.resolve(constantPool); 82 83 interfaceMethodName = nt.getName(); 84 interfaceMethodType = nt.getType(); 85 86 super.resolve(constantPool); 87 } 88 89 94 public String toString() { 95 String value; 96 97 if (isResolved()) { 98 value = "InterfaceMethod : Class = " + interfaceMethodClassName 99 + ", name = " + interfaceMethodName + ", type = " 100 + interfaceMethodType; 101 } else { 102 value = "InterfaceMethod : Class index = " + classIndex 103 + ", name and type index = " + nameAndTypeIndex; 104 } 105 106 return value; 107 } 108 109 114 public String getInterfaceMethodClassName() { 115 return interfaceMethodClassName; 116 } 117 118 123 public String getInterfaceMethodName() { 124 return interfaceMethodName; 125 } 126 127 132 public String getInterfaceMethodType() { 133 return interfaceMethodType; 134 } 135 136 } 137 138 | Popular Tags |