Class ClassFile.MethodInfo

  • All Implemented Interfaces:
    Annotatable
    Enclosing class:
    ClassFile

    public class ClassFile.MethodInfo
    extends java.lang.Object
    implements Annotatable
    Representation of a "method_info" structure, as defined by JVMS7 4.6.
    • Constructor Detail

      • MethodInfo

        public MethodInfo​(short accessFlags,
                          short nameIndex,
                          short descriptorIndex,
                          java.util.List<ClassFile.AttributeInfo> attributes)
        Initializes the "method_info" structure.
    • Method Detail

      • getAccessFlags

        public short getAccessFlags()
        Returns:
        The access flags of this method; or'ed values are the constants declared in Mod.
      • getName

        public java.lang.String getName()
        Returns:
        The method's name
      • getDescriptor

        public java.lang.String getDescriptor()
        Returns:
        The method descriptor describing this method
      • addAttribute

        public void addAttribute​(ClassFile.AttributeInfo attribute)
        Adds the attribute to this method.
      • addAnnotationsAttributeEntry

        public void addAnnotationsAttributeEntry​(boolean runtimeVisible,
                                                 java.lang.String fieldDescriptor,
                                                 java.util.Map<java.lang.Short,​ClassFile.ElementValue> elementValuePairs)
        Description copied from interface: Annotatable
        Adds a "Runtime[In]visibleAnnotations" attribute to this object (if that annotation does not yet exist) and adds an entry to it.
        Specified by:
        addAnnotationsAttributeEntry in interface Annotatable
        elementValuePairs - Maps "elemant_name_index" (ClassFile.ConstantUtf8Info) to "element_value", see JVMS8 4.7.16
      • store

        public void store​(java.io.DataOutputStream dos)
                   throws java.io.IOException
        Writes this object to a DataOutputStream, in the format described inJVMS7 4.6.
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object