Package org.apache.bcel.generic
Class ElementValueGen
- java.lang.Object
-
- org.apache.bcel.generic.ElementValueGen
-
- Direct Known Subclasses:
AnnotationElementValueGen,ArrayElementValueGen,ClassElementValueGen,EnumElementValueGen,SimpleElementValueGen
public abstract class ElementValueGen extends java.lang.ObjectGenerates element values in annotations.- Since:
- 6.0
-
-
Field Summary
Fields Modifier and Type Field Description static intANNOTATIONElement value type: annotation.static intARRAYElement value type: array.static intCLASSElement value type: class.protected ConstantPoolGencpGenDeprecated.(since 6.0) will be made private and final; do not access directly, use getterstatic intENUM_CONSTANTElement value type: enum constant.static intPRIMITIVE_BOOLEANElement value type: primitive boolean.static intPRIMITIVE_BYTEElement value type: primitive byte.static intPRIMITIVE_CHARElement value type: primitive char.static intPRIMITIVE_DOUBLEElement value type: primitive double.static intPRIMITIVE_FLOATElement value type: primitive float.static intPRIMITIVE_INTElement value type: primitive int.static intPRIMITIVE_LONGElement value type: primitive long.static intPRIMITIVE_SHORTElement value type: primitive short.static intSTRINGElement value type: string.protected inttypeDeprecated.(since 6.0) will be made private and final; do not access directly, use getter
-
Constructor Summary
Constructors Modifier Constructor Description protectedElementValueGen(int type, ConstantPoolGen cpGen)Constructs an ElementValueGen.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ElementValueGencopy(ElementValue value, ConstantPoolGen cpool, boolean copyPoolEntries)Creates an (modifiable) ElementValueGen copy of an (immutable) ElementValue - constant pool is assumed correct.abstract voiddump(java.io.DataOutputStream dos)Dumps this element value to a DataOutputStream.protected ConstantPoolGengetConstantPool()Gets the constant pool.abstract ElementValuegetElementValue()Subtypes return an immutable variant of the ElementValueGen.intgetElementValueType()Gets the element value type.static ElementValueGenreadElementValue(java.io.DataInput dis, ConstantPoolGen cpGen)Reads an element value from a DataInput.abstract java.lang.StringstringifyValue()Returns a string representation of the element value.
-
-
-
Field Detail
-
STRING
public static final int STRING
Element value type: string.- See Also:
- Constant Field Values
-
ENUM_CONSTANT
public static final int ENUM_CONSTANT
Element value type: enum constant.- See Also:
- Constant Field Values
-
CLASS
public static final int CLASS
Element value type: class.- See Also:
- Constant Field Values
-
ANNOTATION
public static final int ANNOTATION
Element value type: annotation.- See Also:
- Constant Field Values
-
ARRAY
public static final int ARRAY
Element value type: array.- See Also:
- Constant Field Values
-
PRIMITIVE_INT
public static final int PRIMITIVE_INT
Element value type: primitive int.- See Also:
- Constant Field Values
-
PRIMITIVE_BYTE
public static final int PRIMITIVE_BYTE
Element value type: primitive byte.- See Also:
- Constant Field Values
-
PRIMITIVE_CHAR
public static final int PRIMITIVE_CHAR
Element value type: primitive char.- See Also:
- Constant Field Values
-
PRIMITIVE_DOUBLE
public static final int PRIMITIVE_DOUBLE
Element value type: primitive double.- See Also:
- Constant Field Values
-
PRIMITIVE_FLOAT
public static final int PRIMITIVE_FLOAT
Element value type: primitive float.- See Also:
- Constant Field Values
-
PRIMITIVE_LONG
public static final int PRIMITIVE_LONG
Element value type: primitive long.- See Also:
- Constant Field Values
-
PRIMITIVE_SHORT
public static final int PRIMITIVE_SHORT
Element value type: primitive short.- See Also:
- Constant Field Values
-
PRIMITIVE_BOOLEAN
public static final int PRIMITIVE_BOOLEAN
Element value type: primitive boolean.- See Also:
- Constant Field Values
-
type
@Deprecated protected int type
Deprecated.(since 6.0) will be made private and final; do not access directly, use getter
-
cpGen
@Deprecated protected ConstantPoolGen cpGen
Deprecated.(since 6.0) will be made private and final; do not access directly, use getter
-
-
Constructor Detail
-
ElementValueGen
protected ElementValueGen(int type, ConstantPoolGen cpGen)Constructs an ElementValueGen.- Parameters:
type- the element value type.cpGen- the constant pool.
-
-
Method Detail
-
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(java.io.DataInput dis, ConstantPoolGen cpGen) throws java.io.IOException
Reads an element value from a DataInput.- Parameters:
dis- the data input stream.cpGen- the constant pool.- Returns:
- the element value read.
- Throws:
java.io.IOException- if an I/O error occurs.
-
dump
public abstract void dump(java.io.DataOutputStream dos) throws java.io.IOExceptionDumps this element value to a DataOutputStream.- Parameters:
dos- the output stream.- Throws:
java.io.IOException- if an I/O error occurs.
-
getConstantPool
protected ConstantPoolGen getConstantPool()
Gets the constant pool.- Returns:
- the constant pool.
-
getElementValue
public abstract ElementValue getElementValue()
Subtypes return an immutable variant of the ElementValueGen.- Returns:
- an immutable variant of the ElementValueGen.
-
getElementValueType
public int getElementValueType()
Gets the element value type.- Returns:
- the element value type.
-
stringifyValue
public abstract java.lang.String stringifyValue()
Returns a string representation of the element value.- Returns:
- a string representation of the element value.
-
-