Class 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.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;
     }
     
    • Method Detail

      • readElementValue

        public static ElementValue readElementValue​(java.io.DataInput input,
                                                    ConstantPool cpool)
                                             throws java.io.IOException
        Reads an element_value as an ElementValue.
        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 an element_value as an ElementValue.
        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
      • stringifyValue

        public abstract java.lang.String stringifyValue()