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 NameAndTypeConstant extends ConstantPoolEntry { 40 static private final Logger log = Log.open(NameAndTypeConstant.class); 41 42 private int _nameIndex; 43 private int _descriptorIndex; 44 45 48 NameAndTypeConstant(ConstantPool pool, int index, 49 int nameIndex, int descriptorIndex) 50 { 51 super(pool, index); 52 53 _nameIndex = nameIndex; 54 _descriptorIndex = descriptorIndex; 55 } 56 57 60 public String getName() 61 { 62 return getConstantPool().getUtf8(_nameIndex).getValue(); 63 } 64 65 68 public String getType() 69 { 70 return getConstantPool().getUtf8(_descriptorIndex).getValue(); 71 } 72 73 76 void write(ByteCodeWriter out) 77 throws IOException 78 { 79 out.write(ConstantPool.CP_NAME_AND_TYPE); 80 out.writeShort(_nameIndex); 81 out.writeShort(_descriptorIndex); 82 } 83 84 87 public int export(ConstantPool target) 88 { 89 return target.addNameAndType(getName(), getType()).getIndex(); 90 } 91 92 public String toString() 93 { 94 return "NameAndTypeConstant[" + getName() + ", " + getType() + "]"; 95 } 96 } 97 | Popular Tags |