1 15 16 package javassist.bytecode.annotation; 17 18 import javassist.bytecode.ConstPool; 19 import java.io.IOException ; 20 21 27 public class ShortMemberValue extends MemberValue { 28 int valueIndex; 29 30 36 public ShortMemberValue(int index, ConstPool cp) { 37 super('S', cp); 38 this.valueIndex = index; 39 } 40 41 46 public ShortMemberValue(short s, ConstPool cp) { 47 super('S', cp); 48 setValue(s); 49 } 50 51 54 public ShortMemberValue(ConstPool cp) { 55 super('S', cp); 56 setValue((short)0); 57 } 58 59 62 public short getValue() { 63 return (short)cp.getIntegerInfo(valueIndex); 64 } 65 66 69 public void setValue(short newValue) { 70 valueIndex = cp.addIntegerInfo(newValue); 71 } 72 73 76 public String toString() { 77 return Short.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.visitShortMemberValue(this); 89 } 90 } 91 | Popular Tags |