Class ElementValue


  • public class ElementValue
    extends Object
    An annotation element value: a tag character and its tag-dependent payload.
    • Constructor Detail

      • ElementValue

        public ElementValue​(int tag,
                            Object value)
        Creates an element value.
        Parameters:
        tag - the element_value tag character
        value - 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 from
        constPool - the constant pool
        Returns:
        the parsed element value