Class MethodNode

    • Method Detail

      • getTypeDescriptor

        public String getTypeDescriptor()
        The type descriptor for a method node is a string containing the name of the method, its return type, and its parameter types in a canonical form. For simplicity, we use the format of a Java declaration without parameter names or generics.
        Returns:
        the type descriptor
      • isVoidMethod

        public boolean isVoidMethod()
      • setCode

        public void setCode​(Statement code)
      • getModifiers

        public int getModifiers()
      • setModifiers

        public void setModifiers​(int modifiers)
      • getName

        public String getName()
      • getParameters

        public Parameter[] getParameters()
      • setParameters

        public void setParameters​(Parameter[] parameters)
      • getReturnType

        public ClassNode getReturnType()
      • setVariableScope

        public void setVariableScope​(VariableScope variableScope)
      • isDynamicReturnType

        public boolean isDynamicReturnType()
      • isAbstract

        public boolean isAbstract()
      • isDefault

        public boolean isDefault()
      • isStatic

        public boolean isStatic()
      • isPublic

        public boolean isPublic()
      • isPrivate

        public boolean isPrivate()
      • isFinal

        public boolean isFinal()
      • isProtected

        public boolean isProtected()
      • isPackageScope

        public boolean isPackageScope()
      • hasDefaultValue

        public boolean hasDefaultValue()
      • isScriptBody

        public boolean isScriptBody()
        Returns:
        true if this method is the run method from a script
      • setIsScriptBody

        public void setIsScriptBody()
        Set the metadata flag for this method to indicate that it is a script body implementation.
        See Also:
        ModuleNode.createStatementsClass()
      • setReturnType

        public void setReturnType​(ClassNode returnType)
      • getExceptions

        public ClassNode[] getExceptions()
      • getFirstStatement

        public Statement getFirstStatement()
      • getGenericsTypes

        public GenericsType[] getGenericsTypes()
      • setGenericsTypes

        public void setGenericsTypes​(GenericsType[] genericsTypes)
      • setAnnotationDefault

        public void setAnnotationDefault​(boolean b)
      • hasAnnotationDefault

        public boolean hasAnnotationDefault()
      • isStaticConstructor

        public boolean isStaticConstructor()
      • isSyntheticPublic

        public boolean isSyntheticPublic()
        Indicates that this method has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code. I.e. it remembers that it has applied Groovy's "public methods by default" rule. This property is typically only of interest to AST transform writers.
        Returns:
        true if this class is public but had no explicit public modifier
      • setSyntheticPublic

        public void setSyntheticPublic​(boolean syntheticPublic)
      • getText

        public String getText()
        Provides a nicely formatted string of the method definition. For simplicity, generic types on some of the elements are not displayed.
        Overrides:
        getText in class ASTNode
        Returns:
        string form of node with some generic elements suppressed