Record Class FunctionDef

java.lang.Object
java.lang.Record
io.micronaut.python.processing.visitor.FunctionDef
Record Components:
name - The name of the function.
arguments - The function arguments.
decorators - The decorators.
returnType - The parsed return type information.
typeComment - The type comment.
typeParams - The type parameters.
documentation - The function documentation string.
isAbstract - Whether the function is abstract (decorated with @abstractmethod).
isStatic - Whether the function is static (decorated with @staticmethod or @classmethod).
isAsync - Whether the function was declared with async def.
hasReturnValue - Whether the function body contains a return statement with a non-None value.
declaringClass - Declaring class, can be null if there is none
All Implemented Interfaces:
ElementDef, MemberDef

public record FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract, boolean isStatic, boolean isAsync, boolean hasReturnValue, ClassDef declaringClass) extends Record implements ElementDef, MemberDef
A FunctionDef node represents a function definition.

FunctionDef(identifier name, arguments args, list[stmt] body, list[expr] decorator_list, expr | None returns, string | None type_comment, list[type_param] type_params)

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • returnType

      public ReturnDef returnType()
      Get the parsed return type as ReturnDef.
    • withClassDef

      public FunctionDef withClassDef(ClassDef classDef)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface ElementDef
      Returns:
      the value of the name record component
    • arguments

      public ArgumentsDef arguments()
      Returns the value of the arguments record component.
      Returns:
      the value of the arguments record component
    • decorators

      public List<DecoratorDef> decorators()
      Returns the value of the decorators record component.
      Specified by:
      decorators in interface ElementDef
      Returns:
      the value of the decorators record component
    • typeComment

      public String typeComment()
      Returns the value of the typeComment record component.
      Returns:
      the value of the typeComment record component
    • typeParams

      public List<TypeVar> typeParams()
      Returns the value of the typeParams record component.
      Returns:
      the value of the typeParams record component
    • documentation

      public String documentation()
      Returns the value of the documentation record component.
      Returns:
      the value of the documentation record component
    • isAbstract

      public boolean isAbstract()
      Returns the value of the isAbstract record component.
      Returns:
      the value of the isAbstract record component
    • isStatic

      public boolean isStatic()
      Returns the value of the isStatic record component.
      Returns:
      the value of the isStatic record component
    • isAsync

      public boolean isAsync()
      Returns the value of the isAsync record component.
      Returns:
      the value of the isAsync record component
    • hasReturnValue

      public boolean hasReturnValue()
      Returns the value of the hasReturnValue record component.
      Returns:
      the value of the hasReturnValue record component
    • declaringClass

      public ClassDef declaringClass()
      Returns the value of the declaringClass record component.
      Specified by:
      declaringClass in interface MemberDef
      Returns:
      the value of the declaringClass record component