1 15 package javassist.bytecode.annotation; 16 17 import javassist.bytecode.ConstPool; 18 import java.io.IOException ; 19 20 26 public class ByteMemberValue extends MemberValue { 27 int valueIndex; 28 29 35 public ByteMemberValue(int index, ConstPool cp) { 36 super('B', cp); 37 this.valueIndex = index; 38 } 39 40 45 public ByteMemberValue(byte b, ConstPool cp) { 46 super('B', cp); 47 setValue(b); 48 } 49 50 53 public ByteMemberValue(ConstPool cp) { 54 super('B', cp); 55 setValue((byte)0); 56 } 57 58 61 public byte getValue() { 62 return (byte)cp.getIntegerInfo(valueIndex); 63 } 64 65 68 public void setValue(byte newValue) { 69 valueIndex = cp.addIntegerInfo(newValue); 70 } 71 72 75 public String toString() { 76 return Byte.toString(getValue()); 77 } 78 79 void write(AnnotationsWriter writer) throws IOException { 80 writer.constValueIndex(getValue()); 81 } 82 83 86 public void accept(MemberValueVisitor visitor) { 87 visitor.visitByteMemberValue(this); 88 } 89 } 90 | Popular Tags |