Package org.apache.bcel.generic
Class SimpleElementValueGen
- java.lang.Object
-
- org.apache.bcel.generic.ElementValueGen
-
- org.apache.bcel.generic.SimpleElementValueGen
-
public class SimpleElementValueGen extends ElementValueGen
Generates simple element values in annotations.- Since:
- 6.0
-
-
Field Summary
-
Fields inherited from class org.apache.bcel.generic.ElementValueGen
ANNOTATION, ARRAY, CLASS, cpGen, ENUM_CONSTANT, PRIMITIVE_BOOLEAN, PRIMITIVE_BYTE, PRIMITIVE_CHAR, PRIMITIVE_DOUBLE, PRIMITIVE_FLOAT, PRIMITIVE_INT, PRIMITIVE_LONG, PRIMITIVE_SHORT, STRING, type
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleElementValueGen(int type, int idx, ConstantPoolGen cpGen)Protected ctor used for deserialization, doesn't *put* an entry in the constant pool, assumes the one at the supplied index is correct.SimpleElementValueGen(int type, ConstantPoolGen cpGen, boolean value)Constructs a SimpleElementValueGen for a boolean value.SimpleElementValueGen(int type, ConstantPoolGen cpGen, byte value)Constructs a SimpleElementValueGen for a byte value.SimpleElementValueGen(int type, ConstantPoolGen cpGen, char value)Constructs a SimpleElementValueGen for a char value.SimpleElementValueGen(int type, ConstantPoolGen cpGen, double value)Constructs a SimpleElementValueGen for a double value.SimpleElementValueGen(int type, ConstantPoolGen cpGen, float value)Constructs a SimpleElementValueGen for a float value.SimpleElementValueGen(int type, ConstantPoolGen cpGen, int value)Constructs a SimpleElementValueGen for an int value.SimpleElementValueGen(int type, ConstantPoolGen cpGen, long value)Constructs a SimpleElementValueGen for a long value.SimpleElementValueGen(int type, ConstantPoolGen cpGen, short value)Constructs a SimpleElementValueGen for a short value.SimpleElementValueGen(int type, ConstantPoolGen cpGen, java.lang.String value)Constructs a SimpleElementValueGen for a String value.SimpleElementValueGen(SimpleElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries)The boolean controls whether we copy info from the 'old' constant pool to the 'new'.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddump(java.io.DataOutputStream dos)Dumps this element value to a DataOutputStream.ElementValuegetElementValue()Gets the immutable variant.intgetIndex()Gets the constant pool index.intgetValueInt()Gets the int value.java.lang.StringgetValueString()Gets the string value.java.lang.StringstringifyValue()Returns a string representation of the element value.-
Methods inherited from class org.apache.bcel.generic.ElementValueGen
copy, getConstantPool, getElementValueType, readElementValue
-
-
-
-
Constructor Detail
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, boolean value)
Constructs a SimpleElementValueGen for a boolean value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The boolean value.
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, byte value)
Constructs a SimpleElementValueGen for a byte value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The byte value.
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, char value)
Constructs a SimpleElementValueGen for a char value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The char value.
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, double value)
Constructs a SimpleElementValueGen for a double value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The double value.
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, float value)
Constructs a SimpleElementValueGen for a float value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The float value.
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, int value)
Constructs a SimpleElementValueGen for an int value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The int value.
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, long value)
Constructs a SimpleElementValueGen for a long value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The long value.
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, short value)
Constructs a SimpleElementValueGen for a short value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The short value.
-
SimpleElementValueGen
public SimpleElementValueGen(int type, ConstantPoolGen cpGen, java.lang.String value)
Constructs a SimpleElementValueGen for a String value.- Parameters:
type- The element value type.cpGen- The constant pool generator.value- The string value.
-
SimpleElementValueGen
protected SimpleElementValueGen(int type, int idx, ConstantPoolGen cpGen)
Protected ctor used for deserialization, doesn't *put* an entry in the constant pool, assumes the one at the supplied index is correct.- Parameters:
type- The element value type.idx- The constant pool index.cpGen- The constant pool generator.
-
SimpleElementValueGen
public SimpleElementValueGen(SimpleElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries)
The boolean controls whether we copy info from the 'old' constant pool to the 'new'. You need to use this ctor if the annotation is being copied from one file to another.- Parameters:
value- The simple element value to copy.cpool- The constant pool generator.copyPoolEntries- whether to copy pool entries.
-
-
Method Detail
-
dump
public void dump(java.io.DataOutputStream dos) throws java.io.IOException
Description copied from class:ElementValueGenDumps this element value to a DataOutputStream.- Specified by:
dumpin classElementValueGen- Parameters:
dos- The output stream.- Throws:
java.io.IOException- Thrown if an I/O error occurs.
-
getElementValue
public ElementValue getElementValue()
Gets the immutable variant.- Specified by:
getElementValuein classElementValueGen- Returns:
- The immutable variant.
-
getIndex
public int getIndex()
Gets the constant pool index.- Returns:
- The index.
-
getValueInt
public int getValueInt()
Gets the int value.- Returns:
- The int value.
-
getValueString
public java.lang.String getValueString()
Gets the string value.- Returns:
- The string value.
-
stringifyValue
public java.lang.String stringifyValue()
Description copied from class:ElementValueGenReturns a string representation of the element value.- Specified by:
stringifyValuein classElementValueGen- Returns:
- A string representation of the element value.
-
-