1 15 16 package javassist.bytecode.annotation; 17 18 import javassist.bytecode.ConstPool; 19 import java.io.IOException ; 20 21 27 public class IntegerMemberValue extends MemberValue { 28 int valueIndex; 29 30 36 public IntegerMemberValue(int index, ConstPool cp) { 37 super('I', cp); 38 this.valueIndex = index; 39 } 40 41 52 public IntegerMemberValue(ConstPool cp, int value) { 53 super('I', cp); 54 setValue(value); 55 } 56 57 60 public IntegerMemberValue(ConstPool cp) { 61 super('I', cp); 62 setValue(0); 63 } 64 65 68 public int getValue() { 69 return cp.getIntegerInfo(valueIndex); 70 } 71 72 75 public void setValue(int newValue) { 76 valueIndex = cp.addIntegerInfo(newValue); 77 } 78 79 82 public String toString() { 83 return Integer.toString(getValue()); 84 } 85 86 void write(AnnotationsWriter writer) throws IOException { 87 writer.constValueIndex(getValue()); 88 } 89 90 93 public void accept(MemberValueVisitor visitor) { 94 visitor.visitIntegerMemberValue(this); 95 } 96 } 97 | Popular Tags |