Class MethodNodeBuilder


  • public final class MethodNodeBuilder
    extends Object
    Builder to create instance of type MethodNode
    Since:
    0.1.0
    • Method Detail

      • method

        public static MethodNodeBuilder method​(String name)
        Sets the method name and creates an instance of MethodNodeBuilder
        Parameters:
        name - the name of the method
        Returns:
        the current builder instance
        Since:
        0.1.0
      • returnType

        public MethodNodeBuilder returnType​(Class returnType)
        Sets the return type of the method
        Parameters:
        returnType - a Class representing the return type of the method
        Returns:
        the current builder instance
        Since:
        0.1.0
      • modifiers

        public MethodNodeBuilder modifiers​(int modifiers)
        Sets the method modifiers (public, protected...). You can use Types to find proper modifier values.
        Parameters:
        modifiers - an int representing the type of the modifiers
        Returns:
        the current builder instance
        Since:
        0.1.0
        See Also:
        Types
      • parameters

        public MethodNodeBuilder parameters​(Parameter... parameters)
        Declares which parameters this method may receive
        Parameters:
        parameters - an array of instances of type Parameter
        Returns:
        the current builder instance
        Since:
        0.1.0
      • exceptions

        public MethodNodeBuilder exceptions​(ClassNode... exceptions)
        Declares which type of exceptions this method may throw
        Parameters:
        exceptions - an array of ClassNode representing the different type of exceptions this method may throw
        Returns:
        the current builder instance
        Since:
        0.1.0
      • code

        public MethodNodeBuilder code​(Statement code)
        Sets the content of the method
        Parameters:
        code - the method's code. It has to be of type Statement
        Returns:
        the current builder instance
        Since:
        0.1.0
      • build

        public MethodNode build()
        Returns the configured instance
        Returns:
        an instance of type MethodNode
        Since:
        0.1.0