1 28 29 package com.caucho.bytecode; 30 31 import com.caucho.log.Log; 32 33 import java.io.IOException ; 34 import java.util.logging.Logger ; 35 36 39 public class InterfaceMethodRefConstant extends ConstantPoolEntry { 40 static private final Logger log = Log.open(MethodRefConstant.class); 41 42 private int _classIndex; 43 private int _nameAndTypeIndex; 44 45 48 InterfaceMethodRefConstant(ConstantPool pool, int index, 49 int classIndex, int nameAndTypeIndex) 50 { 51 super(pool, index); 52 53 _classIndex = classIndex; 54 _nameAndTypeIndex = nameAndTypeIndex; 55 } 56 57 60 public String getClassName() 61 { 62 return getConstantPool().getClass(_classIndex).getName(); 63 } 64 65 68 public String getName() 69 { 70 return getConstantPool().getNameAndType(_nameAndTypeIndex).getName(); 71 } 72 73 76 public String getType() 77 { 78 return getConstantPool().getNameAndType(_nameAndTypeIndex).getType(); 79 } 80 81 84 public void setNameAndType(String name, String type) 85 { 86 _nameAndTypeIndex = getConstantPool().addNameAndType(name, type).getIndex(); 87 } 88 89 92 void write(ByteCodeWriter out) 93 throws IOException 94 { 95 out.write(ConstantPool.CP_INTERFACE_METHOD_REF); 96 out.writeShort(_classIndex); 97 out.writeShort(_nameAndTypeIndex); 98 } 99 100 103 public int export(ConstantPool target) 104 { 105 return target.addInterfaceRef(getClassName(), getName(), getType()).getIndex(); 106 } 107 108 public String toString() 109 { 110 return "InterfaceMethodRefConstant[" + getClassName() + "." + getName() + "(" + getType() + ")]"; 111 } 112 } 113 | Popular Tags |