Package org.apache.bcel.classfile
Class ElementValue
- java.lang.Object
-
- org.apache.bcel.classfile.ElementValue
-
- Direct Known Subclasses:
AnnotationElementValue
,ArrayElementValue
,ClassElementValue
,EnumElementValue
,SimpleElementValue
public abstract class ElementValue extends java.lang.Object
The element_value structure is documented at https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.7.16.1element_value { u1 tag; union { u2 const_value_index; { u2 type_name_index; u2 const_name_index; } enum_const_value; u2 class_info_index; annotation annotation_value; { u2 num_values; element_value values[num_values]; } array_value; } value; }
- Since:
- 6.0
-
-
Field Summary
Fields Modifier and Type Field Description static byte
ANNOTATION
static byte
ARRAY
static byte
CLASS
protected ConstantPool
cpool
Deprecated.(since 6.0) will be made private and final; do not access directly, use getterstatic byte
ENUM_CONSTANT
static byte
PRIMITIVE_BOOLEAN
static byte
PRIMITIVE_BYTE
static byte
PRIMITIVE_CHAR
static byte
PRIMITIVE_DOUBLE
static byte
PRIMITIVE_FLOAT
static byte
PRIMITIVE_INT
static byte
PRIMITIVE_LONG
static byte
PRIMITIVE_SHORT
static byte
STRING
protected int
type
Deprecated.(since 6.0) will be made private and final; do not access directly, use getter
-
Constructor Summary
Constructors Modifier Constructor Description protected
ElementValue(int type, ConstantPool cpool)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
dump(java.io.DataOutputStream dos)
(package private) ConstantPool
getConstantPool()
int
getElementValueType()
(package private) int
getType()
static ElementValue
readElementValue(java.io.DataInput input, ConstantPool cpool)
Reads anelement_value
as anElementValue
.static ElementValue
readElementValue(java.io.DataInput input, ConstantPool cpool, int arrayNesting)
Reads anelement_value
as anElementValue
.abstract java.lang.String
stringifyValue()
java.lang.String
toShortString()
java.lang.String
toString()
-
-
-
Field Detail
-
STRING
public static final byte STRING
- See Also:
- Constant Field Values
-
ENUM_CONSTANT
public static final byte ENUM_CONSTANT
- See Also:
- Constant Field Values
-
CLASS
public static final byte CLASS
- See Also:
- Constant Field Values
-
ANNOTATION
public static final byte ANNOTATION
- See Also:
- Constant Field Values
-
ARRAY
public static final byte ARRAY
- See Also:
- Constant Field Values
-
PRIMITIVE_INT
public static final byte PRIMITIVE_INT
- See Also:
- Constant Field Values
-
PRIMITIVE_BYTE
public static final byte PRIMITIVE_BYTE
- See Also:
- Constant Field Values
-
PRIMITIVE_CHAR
public static final byte PRIMITIVE_CHAR
- See Also:
- Constant Field Values
-
PRIMITIVE_DOUBLE
public static final byte PRIMITIVE_DOUBLE
- See Also:
- Constant Field Values
-
PRIMITIVE_FLOAT
public static final byte PRIMITIVE_FLOAT
- See Also:
- Constant Field Values
-
PRIMITIVE_LONG
public static final byte PRIMITIVE_LONG
- See Also:
- Constant Field Values
-
PRIMITIVE_SHORT
public static final byte PRIMITIVE_SHORT
- See Also:
- Constant Field Values
-
PRIMITIVE_BOOLEAN
public static final byte 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
-
cpool
@Deprecated protected ConstantPool cpool
Deprecated.(since 6.0) will be made private and final; do not access directly, use getter
-
-
Constructor Detail
-
ElementValue
protected ElementValue(int type, ConstantPool cpool)
-
-
Method Detail
-
readElementValue
public static ElementValue readElementValue(java.io.DataInput input, ConstantPool cpool) throws java.io.IOException
Reads anelement_value
as anElementValue
.- Parameters:
input
- Raw data input.cpool
- Constant pool.- Returns:
- a new ElementValue.
- Throws:
java.io.IOException
- if an I/O error occurs.
-
readElementValue
public static ElementValue readElementValue(java.io.DataInput input, ConstantPool cpool, int arrayNesting) throws java.io.IOException
Reads anelement_value
as anElementValue
.- Parameters:
input
- Raw data input.cpool
- Constant pool.arrayNesting
- level of current array nesting.- Returns:
- a new ElementValue.
- Throws:
java.io.IOException
- if an I/O error occurs.- Since:
- 6.7.0
-
dump
public abstract void dump(java.io.DataOutputStream dos) throws java.io.IOException
- Throws:
java.io.IOException
-
getConstantPool
final ConstantPool getConstantPool()
- Since:
- 6.0
-
getElementValueType
public int getElementValueType()
-
getType
final int getType()
- Since:
- 6.0
-
stringifyValue
public abstract java.lang.String stringifyValue()
-
toShortString
public java.lang.String toShortString()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-