Package org.apache.bcel.generic
Class ElementValueGen
java.lang.Object
org.apache.bcel.generic.ElementValueGen
- Direct Known Subclasses:
AnnotationElementValueGen,ArrayElementValueGen,ClassElementValueGen,EnumElementValueGen,SimpleElementValueGen
Generates element values in annotations.
- Since:
- 6.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intElement value type: annotation.static final intElement value type: array.static final intElement value type: class.protected ConstantPoolGenDeprecated.(since 6.0) will be made private and final; do not access directly, use getterstatic final intElement value type: enum constant.static final intElement value type: primitive boolean.static final intElement value type: primitive byte.static final intElement value type: primitive char.static final intElement value type: primitive double.static final intElement value type: primitive float.static final intElement value type: primitive int.static final intElement value type: primitive long.static final intElement value type: primitive short.static final intElement value type: string.protected intDeprecated.(since 6.0) will be made private and final; do not access directly, use getter -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedElementValueGen(int type, ConstantPoolGen cpGen) Constructs an ElementValueGen. -
Method Summary
Modifier and TypeMethodDescriptionstatic ElementValueGencopy(ElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries) Creates an (modifiable) ElementValueGen copy of an (immutable) ElementValue - constant pool is assumed correct.abstract voiddump(DataOutputStream dos) Dumps this element value to a DataOutputStream.protected ConstantPoolGenGets the constant pool.abstract ElementValueSubtypes return an immutable variant of the ElementValueGen.intGets the element value type.static ElementValueGenreadElementValue(DataInput dis, ConstantPoolGen cpGen) Reads an element value from a DataInput.abstract StringReturns a string representation of the element value.
-
Field Details
-
STRING
Element value type: string.- See Also:
-
ENUM_CONSTANT
Element value type: enum constant.- See Also:
-
CLASS
Element value type: class.- See Also:
-
ANNOTATION
Element value type: annotation.- See Also:
-
ARRAY
Element value type: array.- See Also:
-
PRIMITIVE_INT
Element value type: primitive int.- See Also:
-
PRIMITIVE_BYTE
Element value type: primitive byte.- See Also:
-
PRIMITIVE_CHAR
Element value type: primitive char.- See Also:
-
PRIMITIVE_DOUBLE
Element value type: primitive double.- See Also:
-
PRIMITIVE_FLOAT
Element value type: primitive float.- See Also:
-
PRIMITIVE_LONG
Element value type: primitive long.- See Also:
-
PRIMITIVE_SHORT
Element value type: primitive short.- See Also:
-
PRIMITIVE_BOOLEAN
Element value type: primitive boolean.- See Also:
-
type
Deprecated.(since 6.0) will be made private and final; do not access directly, use getter -
cpGen
Deprecated.(since 6.0) will be made private and final; do not access directly, use getter
-
-
Constructor Details
-
ElementValueGen
Constructs an ElementValueGen.- Parameters:
type- The element value type.cpGen- The constant pool.
-
-
Method Details
-
copy
public static ElementValueGen copy(ElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries) Creates an (modifiable) ElementValueGen copy of an (immutable) ElementValue - constant pool is assumed correct.- Parameters:
value- The element value to copy.cpool- The constant pool generator.copyPoolEntries- whether to copy pool entries.- Returns:
- A copy of the element value.
-
readElementValue
public static ElementValueGen readElementValue(DataInput dis, ConstantPoolGen cpGen) throws IOException Reads an element value from a DataInput.- Parameters:
dis- The data input stream.cpGen- The constant pool.- Returns:
- The element value read.
- Throws:
IOException- Thrown if an I/O error occurs.
-
dump
Dumps this element value to a DataOutputStream.- Parameters:
dos- The output stream.- Throws:
IOException- Thrown if an I/O error occurs.
-
getConstantPool
Gets the constant pool.- Returns:
- The constant pool.
-
getElementValue
Subtypes return an immutable variant of the ElementValueGen.- Returns:
- An immutable variant of the ElementValueGen.
-
getElementValueType
Gets the element value type.- Returns:
- The element value type.
-
stringifyValue
Returns a string representation of the element value.- Returns:
- A string representation of the element value.
-