public final class ConstantValueAttribute_info extends Attribute_info
Field_info structures. A ConstantValue
attribute represents the value of a constant field that must be (explicitly or
implicitly) static; that is, the ACC_STATIC bit in the flags item of the
Field_info structure must be set. The field is not required to be final. There
can be no more than one ConstantValue attribute in the attributes table of a
given Field_info structure. The constant field represented by the Field_info
structure is assigned the value referenced by its ConstantValue attribute as
part of its initialization.The ConstantValue attribute has the format
ConstantValue_attribute {
u2 attribute_name_index;
u4 attribute_length;
u2 constantvalue_index;
}
The value of the constantvalue_index item must be a valid index into the constant
pool table. The constant pool entry at that index must give the constant value
represented by this attribute.The constant pool entry must be of a type appropriate to the field, as shown below:
| Field Type | Entry Type |
|---|---|
| long | CONSTANT_Long |
| float | CONSTANT_Float |
| double | CONSTANT_Double |
| int, short, char, byte, boolean | CONSTANT_Integer |
| java.lang.String | CONSTANT_String |
| 限定符和类型 | 字段和说明 |
|---|---|
int |
m_value_index |
ATTRIBUTE_BRIDGE, ATTRIBUTE_CODE, ATTRIBUTE_CONSTANT_VALUE, ATTRIBUTE_EXCEPTIONS, ATTRIBUTE_INNERCLASSES, ATTRIBUTE_LINE_NUMBER_TABLE, ATTRIBUTE_SOURCEFILE, ATTRIBUTE_SYNTHETIC, m_attribute_length, m_name_index| 构造器和说明 |
|---|
ConstantValueAttribute_info(int attribute_name_index,
int value_index) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
accept(IAttributeVisitor visitor,
java.lang.Object ctx) |
java.lang.Object |
clone()
Performs a deep copy.
|
CONSTANT_literal_info |
getValue(ClassDef cls) |
long |
length()
Returns the total length of this attribute when converted to
.class format [including the 6-byte header]
|
java.lang.String |
toString() |
void |
writeInClassFormat(UDataOutputStream out) |
getName, new_Attribute_infopublic ConstantValueAttribute_info(int attribute_name_index,
int value_index)
public CONSTANT_literal_info getValue(ClassDef cls)
public long length()
Attribute_infolength 在类中 Attribute_infopublic void accept(IAttributeVisitor visitor, java.lang.Object ctx)
accept 在类中 Attribute_infopublic java.lang.String toString()
toString 在类中 Attribute_infopublic java.lang.Object clone()
clone 在类中 Attribute_infopublic void writeInClassFormat(UDataOutputStream out) throws java.io.IOException
writeInClassFormat 在接口中 IClassFormatOutputwriteInClassFormat 在类中 Attribute_infojava.io.IOExceptionCopyright © 2018. All Rights Reserved.