Class Method

  • All Implemented Interfaces:
    ASTNode, Member

    public class Method
    extends AbstractMember
    Represents a method in a Java type.
    Version:
    1.0
    • Field Detail

      • type

        private Type type
      • thrownTypeNames

        private java.util.List<java.lang.String> thrownTypeNames
      • deprecated

        private boolean deprecated
      • docComment

        private java.lang.String docComment
    • Method Detail

      • getBodyContainsOffset

        public boolean getBodyContainsOffset​(int offs)
        Returns whether this method's body contains the specified offset.
        Parameters:
        offs - The offset to check.
        Returns:
        Whether this method's body contains that offset.
      • getBodyEndOffset

        public int getBodyEndOffset()
      • getBodyStartOffset

        public int getBodyStartOffset()
      • getDocComment

        public java.lang.String getDocComment()
        Description copied from interface: Member
        Returns the doc comment for this member.
        Returns:
        This member's doc comment.
      • getModifiers

        public Modifiers getModifiers()
        Description copied from interface: Member
        Returns the modifiers of this member.
        Returns:
        The modifiers.
      • getNameAndParameters

        public java.lang.String getNameAndParameters()
        Returns this method name and parameters, as a string, in the format methodName(Type1 param1, Type2 param2).
        Returns:
        This method's name and parameters.
      • getParameter

        public FormalParameter getParameter​(int index)
        Returns the specified formal parameter.
        Parameters:
        index - The parameter's index.
        Returns:
        The formal parameter.
        See Also:
        getParameterCount()
      • getParameterCount

        public int getParameterCount()
      • getParameterIterator

        public java.util.Iterator<FormalParameter> getParameterIterator()
      • getThrownTypeNameCount

        public int getThrownTypeNameCount()
      • getType

        public Type getType()
        Description copied from interface: Member
        Returns the type of this member.
        Returns:
        This member's type.
      • isConstructor

        public boolean isConstructor()
      • isDeprecated

        public boolean isDeprecated()
        Description copied from interface: Member
        Returns whether this member is deprecated.
        Returns:
        Whether this member is deprecated.
      • setBody

        public void setBody​(CodeBlock body)
      • setDeprecated

        public void setDeprecated​(boolean deprecated)
      • setDocComment

        public void setDocComment​(java.lang.String comment)