1 15 16 package javassist.bytecode.annotation; 17 18 import javassist.bytecode.ConstPool; 19 import java.io.IOException ; 20 21 28 public class DoubleMemberValue extends MemberValue { 29 int valueIndex; 30 31 37 public DoubleMemberValue(int index, ConstPool cp) { 38 super('D', cp); 39 this.valueIndex = index; 40 } 41 42 47 public DoubleMemberValue(double d, ConstPool cp) { 48 super('D', cp); 49 setValue(d); 50 } 51 52 55 public DoubleMemberValue(ConstPool cp) { 56 super('D', cp); 57 setValue(0.0); 58 } 59 60 63 public double getValue() { 64 return cp.getDoubleInfo(valueIndex); 65 } 66 67 70 public void setValue(double newValue) { 71 valueIndex = cp.addDoubleInfo(newValue); 72 } 73 74 77 public String toString() { 78 return Double.toString(getValue()); 79 } 80 81 void write(AnnotationsWriter writer) throws IOException { 82 writer.constValueIndex(getValue()); 83 } 84 85 88 public void accept(MemberValueVisitor visitor) { 89 visitor.visitDoubleMemberValue(this); 90 } 91 } 92 | Popular Tags |