1 23 24 25 package com.sun.jdo.api.persistence.enhancer.classfile; 26 27 import java.io.*; 28 29 32 33 public class ConstClass extends ConstBasic { 34 35 public static final int MyTag = CONSTANTClass; 36 37 38 private ConstUtf8 theClassName; 39 40 42 private int theClassNameIndex; 43 44 45 46 49 public int tag () { return MyTag; } 50 51 54 public ConstUtf8 className() { 55 return theClassName; 56 } 57 58 61 public String asString() { 62 return theClassName.asString(); 63 } 64 65 68 public String toString () { 69 return "CONSTANTClass(" + indexAsString() + "): " + "className(" + theClassName.toString() + ")"; } 72 73 76 public void changeClass(ConstUtf8 newName) { 77 theClassName = newName; 78 theClassNameIndex = newName.getIndex(); 79 } 80 81 82 83 86 public ConstClass (ConstUtf8 cname) { 87 theClassName = cname; 88 } 89 90 ConstClass (int cname) { 91 theClassNameIndex = cname; 92 } 93 94 void formatData (DataOutputStream b) throws IOException { 95 b.writeShort(theClassName.getIndex()); 96 } 97 98 static ConstClass read (DataInputStream input) throws IOException { 99 return new ConstClass (input.readUnsignedShort()); 100 } 101 102 void resolve (ConstantPool p) { 103 theClassName = (ConstUtf8) p.constantAt(theClassNameIndex); 104 } 105 } 106 107 | Popular Tags |