1 29 30 package com.caucho.bytecode; 31 32 import com.caucho.log.Log; 33 34 import java.io.IOException ; 35 import java.util.logging.Logger ; 36 37 40 public class ClassConstant extends ConstantPoolEntry { 41 static private final Logger log = Log.open(ClassConstant.class); 42 43 private int _nameIndex; 44 45 48 ClassConstant(ConstantPool pool, int index, int nameIndex) 49 { 50 super(pool, index); 51 52 _nameIndex = nameIndex; 53 } 54 55 58 public String getName() 59 { 60 return getConstantPool().getUtf8(_nameIndex).getValue(); 61 } 62 63 66 public int getNameIndex() 67 { 68 return _nameIndex; 69 } 70 71 74 public void setNameIndex(int index) 75 { 76 _nameIndex = index; 77 } 78 79 82 void write(ByteCodeWriter out) 83 throws IOException 84 { 85 out.write(ConstantPool.CP_CLASS); 86 out.writeShort(_nameIndex); 87 } 88 89 92 public int export(ConstantPool target) 93 { 94 return target.addClass(getName()).getIndex(); 95 } 96 97 public String toString() 98 { 99 return "ClassConstant[" + getName() + "]"; 100 } 101 } 102 | Popular Tags |