1 15 16 package javassist.bytecode.annotation; 17 18 import javassist.bytecode.ConstPool; 19 import java.io.IOException ; 20 21 27 public class CharMemberValue extends MemberValue { 28 int valueIndex; 29 30 36 public CharMemberValue(int index, ConstPool cp) { 37 super('C', cp); 38 this.valueIndex = index; 39 } 40 41 46 public CharMemberValue(char c, ConstPool cp) { 47 super('C', cp); 48 setValue(c); 49 } 50 51 54 public CharMemberValue(ConstPool cp) { 55 super('C', cp); 56 setValue('\0'); 57 } 58 59 62 public char getValue() { 63 return (char)cp.getIntegerInfo(valueIndex); 64 } 65 66 69 public void setValue(char newValue) { 70 valueIndex = cp.addIntegerInfo(newValue); 71 } 72 73 76 public String toString() { 77 return Character.toString(getValue()); 78 } 79 80 void write(AnnotationsWriter writer) throws IOException { 81 writer.constValueIndex(getValue()); 82 } 83 84 87 public void accept(MemberValueVisitor visitor) { 88 visitor.visitCharMemberValue(this); 89 } 90 } 91 | Popular Tags |