Class DirectivesMethod

  • All Implemented Interfaces:
    Iterable<org.xembly.Directive>

    public final class DirectivesMethod
    extends Object
    implements Iterable<org.xembly.Directive>
    Directives Method. All the directives are sorted according to JVM method specification: method_info { u2 access_flags; {@link DirectivesMethodProperties} u2 name_index; {@link DirectivesMethodProperties} u2 descriptor_index; {@link DirectivesMethodProperties} u2 attributes_count; {@link DirectivesMethod} attribute_info attributes[attributes_count]; {@link DirectivesMethod} } Pay attention, that most of the information about methods are stored into attributes: - Body (Code) - Annotations - Try-catch blocks - Default value (for annotation methods) - And other attributes
    Since:
    0.1
    • Constructor Detail

      • DirectivesMethod

        public DirectivesMethod​(String name)
        Constructor.
        Parameters:
        name - Method name
      • DirectivesMethod

        public DirectivesMethod​(String name,
                                DirectivesMethodProperties properties)
        Constructor.
        Parameters:
        name - Method name
        properties - Method properties
      • DirectivesMethod

        public DirectivesMethod​(Format format,
                                NumberedName name,
                                DirectivesMethodProperties properties,
                                List<Iterable<org.xembly.Directive>> instructions,
                                List<Iterable<org.xembly.Directive>> tryblocks,
                                DirectivesAnnotations annotations,
                                List<Iterable<org.xembly.Directive>> dvalue,
                                DirectivesAttributes attributes)
        Constructor.
        Parameters:
        format - Directives format
        name - Method name
        properties - Method properties
        instructions - Method instructions
        tryblocks - Method try-catch blocks
        annotations - Method annotations
        dvalue - Annotation default value
        attributes - Method attributes
        Suppressed Checkstyle violations:
        ParameterNumberCheck (10 lines)
    • Method Detail

      • withOpcode

        public DirectivesMethod withOpcode​(int index,
                                           int opcode,
                                           Object... operands)
        Add opcode to the directives.
        Parameters:
        index - Instruction index
        opcode - Opcode
        operands - Operands
        Returns:
        This object
      • withAnnotation

        public DirectivesMethod withAnnotation​(DirectivesAnnotation annotation)
        Add annotation to the directives.
        Parameters:
        annotation - Annotation directives.
        Returns:
        This object.
      • iterator

        public Iterator<org.xembly.Directive> iterator()
        Specified by:
        iterator in interface Iterable<org.xembly.Directive>