javassist.bytecode.annotation
Class IntegerMemberValue

java.lang.Object
  extended by javassist.bytecode.annotation.MemberValue
      extended by javassist.bytecode.annotation.IntegerMemberValue

public class IntegerMemberValue
extends MemberValue

Integer constant value.

Author:
Bill Burke, Shigeru Chiba

Constructor Summary
IntegerMemberValue(ConstPool cp)
          Constructs an int constant value.
IntegerMemberValue(ConstPool cp, int value)
          Constructs an int constant value.
IntegerMemberValue(int index, ConstPool cp)
          Constructs an int constant value.
 
Method Summary
 void accept(MemberValueVisitor visitor)
          Accepts a visitor.
 int getValue()
          Obtains the value of the member.
 void setValue(int newValue)
          Sets the value of the member.
 java.lang.String toString()
          Obtains the string representation of this object.
 void write(AnnotationsWriter writer)
          Writes the value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerMemberValue

public IntegerMemberValue(int index,
                          ConstPool cp)
Constructs an int constant value. The initial value is specified by the constant pool entry at the given index.

Parameters:
index - the index of a CONSTANT_Integer_info structure.

IntegerMemberValue

public IntegerMemberValue(ConstPool cp,
                          int value)
Constructs an int constant value. Note that this constructor receives the initial value as the second parameter unlike the corresponding constructors in the sibling classes. This is for making a difference from the constructor that receives an index into the constant pool table as the first parameter. Note that the index is also int type.

Parameters:
value - the initial value.

IntegerMemberValue

public IntegerMemberValue(ConstPool cp)
Constructs an int constant value. The initial value is 0.

Method Detail

getValue

public int getValue()
Obtains the value of the member.


setValue

public void setValue(int newValue)
Sets the value of the member.


toString

public java.lang.String toString()
Obtains the string representation of this object.

Overrides:
toString in class java.lang.Object

write

public void write(AnnotationsWriter writer)
           throws java.io.IOException
Writes the value.

Specified by:
write in class MemberValue
Throws:
java.io.IOException

accept

public void accept(MemberValueVisitor visitor)
Accepts a visitor.

Specified by:
accept in class MemberValue


Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.