Class ElementValue
- java.lang.Object
-
- com.tonic.parser.attribute.annotation.ElementValue
-
public class ElementValue extends Object
An annotation element value: a tag character and its tag-dependent payload.
-
-
Constructor Summary
Constructors Constructor Description ElementValue(int tag, Object value)Creates an element value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetLength()Calculates the total length of this element value in bytes.intgetTag()ObjectgetValue()static ElementValuereadElementValue(ClassFile classFile, ConstPool constPool)Reads an element value from the class file.StringtoString()voidwrite(DataOutputStream dos)Writes this element value to the output stream.
-
-
-
Constructor Detail
-
ElementValue
public ElementValue(int tag, Object value)Creates an element value.- Parameters:
tag- the element_value tag charactervalue- the payload, whose type depends on the tag
-
-
Method Detail
-
getTag
public int getTag()
- Returns:
- the tag
-
getValue
public Object getValue()
- Returns:
- the value
-
write
public void write(DataOutputStream dos) throws IOException
Writes this element value to the output stream.- Parameters:
dos- the output stream- Throws:
IOException- if an I/O error occurs
-
getLength
public int getLength()
Calculates the total length of this element value in bytes.- Returns:
- the length in bytes
-
readElementValue
public static ElementValue readElementValue(ClassFile classFile, ConstPool constPool)
Reads an element value from the class file.- Parameters:
classFile- the class file to read fromconstPool- the constant pool- Returns:
- the parsed element value
-
-