Class ElementValue
java.lang.Object
org.apache.tomcat.util.bcel.classfile.ElementValue
- Direct Known Subclasses:
AnnotationElementValue, ArrayElementValue, ClassElementValue, EnumElementValue, SimpleElementValue
The element_value structure is documented at https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-4.html#jvms-4.7.16.1
element_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;
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteTag for an annotation element value.static final byteTag for an array element value.static final byteTag for a class element value.static final byteTag for an enum constant element value.static final byteTag for a boolean primitive element value.static final byteTag for a byte primitive element value.static final byteTag for a char primitive element value.static final byteTag for a double primitive element value.static final byteTag for a float primitive element value.static final byteTag for an int primitive element value.static final byteTag for a long primitive element value.static final byteTag for a short primitive element value.static final byteTag for a String element value. -
Method Summary
Modifier and TypeMethodDescriptionstatic ElementValuereadElementValue(DataInput input, ConstantPool cpool) Reads anelement_valueas anElementValue.static ElementValuereadElementValue(DataInput input, ConstantPool cpool, int arrayNesting) Reads anelement_valueas anElementValue.abstract StringReturns a string representation of this element value.
-
Field Details
-
STRING
public static final byte STRINGTag for a String element value.- See Also:
-
ENUM_CONSTANT
public static final byte ENUM_CONSTANTTag for an enum constant element value.- See Also:
-
CLASS
public static final byte CLASSTag for a class element value.- See Also:
-
ANNOTATION
public static final byte ANNOTATIONTag for an annotation element value.- See Also:
-
ARRAY
public static final byte ARRAYTag for an array element value.- See Also:
-
PRIMITIVE_INT
public static final byte PRIMITIVE_INTTag for an int primitive element value.- See Also:
-
PRIMITIVE_BYTE
public static final byte PRIMITIVE_BYTETag for a byte primitive element value.- See Also:
-
PRIMITIVE_CHAR
public static final byte PRIMITIVE_CHARTag for a char primitive element value.- See Also:
-
PRIMITIVE_DOUBLE
public static final byte PRIMITIVE_DOUBLETag for a double primitive element value.- See Also:
-
PRIMITIVE_FLOAT
public static final byte PRIMITIVE_FLOATTag for a float primitive element value.- See Also:
-
PRIMITIVE_LONG
public static final byte PRIMITIVE_LONGTag for a long primitive element value.- See Also:
-
PRIMITIVE_SHORT
public static final byte PRIMITIVE_SHORTTag for a short primitive element value.- See Also:
-
PRIMITIVE_BOOLEAN
public static final byte PRIMITIVE_BOOLEANTag for a boolean primitive element value.- See Also:
-
-
Method Details
-
readElementValue
Reads anelement_valueas anElementValue.- Parameters:
input- Raw data input.cpool- Constant pool.- Returns:
- a new ElementValue.
- Throws:
IOException- if an I/O error occurs.
-
readElementValue
public static ElementValue readElementValue(DataInput input, ConstantPool cpool, int arrayNesting) throws IOException Reads anelement_valueas anElementValue.- Parameters:
input- Raw data input.cpool- Constant pool.arrayNesting- level of current array nesting.- Returns:
- a new ElementValue.
- Throws:
IOException- if an I/O error occurs.- Since:
- 6.7.0
-
stringifyValue
Returns a string representation of this element value.- Returns:
- the string representation
-