Package org.apache.bcel.classfile
Class SimpleElementValue
java.lang.Object
org.apache.bcel.classfile.ElementValue
org.apache.bcel.classfile.SimpleElementValue
Represents a simple element value in an annotation.
- Since:
- 6.0
-
Field Summary
FieldsFields inherited from class org.apache.bcel.classfile.ElementValue
ANNOTATION, ARRAY, CLASS, cpool, EMPTY_ARRAY, ENUM_CONSTANT, PRIMITIVE_BOOLEAN, PRIMITIVE_BYTE, PRIMITIVE_CHAR, PRIMITIVE_DOUBLE, PRIMITIVE_FLOAT, PRIMITIVE_INT, PRIMITIVE_LONG, PRIMITIVE_SHORT, STRING, type -
Constructor Summary
ConstructorsConstructorDescriptionSimpleElementValue(int type, int index, ConstantPool cpool) Constructs a SimpleElementValue. -
Method Summary
Modifier and TypeMethodDescriptionvoiddump(DataOutputStream dos) Dumps this element value to a DataOutputStream.intgetIndex()Gets the value entry index in the constant pool.booleanGets the boolean value.byteGets the byte value.charGets the char value.doubleGets the double value.floatGets the float value.intGets the int value.longGets the long value.shortGets the short value.Gets the string value.voidsetIndex(int index) Sets the index into the constant pool.Returns a string representation of the element value.toString()Returns a string representation of the element value.Methods inherited from class org.apache.bcel.classfile.ElementValue
getConstantPool, getElementValueType, getType, readElementValue, readElementValue, readElementValue, toShortString
-
Field Details
-
index
private int index
-
-
Constructor Details
-
SimpleElementValue
Constructs a SimpleElementValue.- Parameters:
type- The element value type.index- The index into the constant pool.cpool- The constant pool.
-
-
Method Details
-
dump
Description copied from class:ElementValueDumps this element value to a DataOutputStream.- Specified by:
dumpin classElementValue- Parameters:
dos- The output stream.- Throws:
IOException- Thrown if an I/O error occurs.
-
getIndex
public int getIndex()Gets the value entry index in the constant pool.- Returns:
- Value entry index in the constant pool.
-
getValueBoolean
public boolean getValueBoolean()Gets the boolean value.- Returns:
- The boolean value.
-
getValueByte
public byte getValueByte()Gets the byte value.- Returns:
- The byte value.
-
getValueChar
public char getValueChar()Gets the char value.- Returns:
- The char value.
-
getValueDouble
public double getValueDouble()Gets the double value.- Returns:
- The double value.
-
getValueFloat
public float getValueFloat()Gets the float value.- Returns:
- The float value.
-
getValueInt
public int getValueInt()Gets the int value.- Returns:
- The int value.
-
getValueLong
public long getValueLong()Gets the long value.- Returns:
- The long value.
-
getValueShort
public short getValueShort()Gets the short value.- Returns:
- The short value.
-
getValueString
Gets the string value.- Returns:
- The string value.
-
setIndex
public void setIndex(int index) Sets the index into the constant pool.- Parameters:
index- The index.
-
stringifyValue
Description copied from class:ElementValueReturns a string representation of the element value.- Specified by:
stringifyValuein classElementValue- Returns:
- A string representation of the element value.
-
toString
Description copied from class:ElementValueReturns a string representation of the element value.- Overrides:
toStringin classElementValue- Returns:
- A string representation of the element value.
-