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 withasync 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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFunctionDef(String name) FunctionDef(String name, ArgumentsDef arguments, ReturnDef returnType) FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType) FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract) FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract, boolean isStatic) FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract, boolean isStatic, boolean isAsync) 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) 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) Creates an instance of aFunctionDefrecord class.FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract, boolean isStatic, ClassDef declaringClass) FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, String returnTypeAnnotation, List<DecoratorDef> returnTypeDecorators) FunctionDef(String name, List<DecoratorDef> decoratorList) FunctionDef(String name, List<String> argumentNames, List<String> argumentTypes, String returnTypeAnnotation) FunctionDef(String name, List<String> argumentNames, List<String> argumentTypes, List<DecoratorDef> decorators, String returnTypeAnnotation) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theargumentsrecord component.Returns the value of thedeclaringClassrecord component.Returns the value of thedecoratorsrecord component.Returns the value of thedocumentationrecord component.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.booleanReturns the value of thehasReturnValuerecord component.booleanReturns the value of theisAbstractrecord component.booleanisAsync()Returns the value of theisAsyncrecord component.booleanisStatic()Returns the value of theisStaticrecord component.name()Returns the value of thenamerecord component.Get the parsed return type as ReturnDef.final StringtoString()Returns a string representation of this record class.Returns the value of thetypeCommentrecord component.Returns the value of thetypeParamsrecord component.withClassDef(ClassDef classDef)
-
Field Details
-
CONSTRUCTOR_NAME
- See Also:
-
-
Constructor Details
-
FunctionDef
public 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) Creates an instance of aFunctionDefrecord class.- Parameters:
name- the value for thenamerecord componentarguments- the value for theargumentsrecord componentdecorators- the value for thedecoratorsrecord componentreturnType- the value for thereturnTyperecord componenttypeComment- the value for thetypeCommentrecord componenttypeParams- the value for thetypeParamsrecord componentdocumentation- the value for thedocumentationrecord componentisAbstract- the value for theisAbstractrecord componentisStatic- the value for theisStaticrecord componentisAsync- the value for theisAsyncrecord componenthasReturnValue- the value for thehasReturnValuerecord componentdeclaringClass- the value for thedeclaringClassrecord component
-
FunctionDef
public FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType) -
FunctionDef
-
FunctionDef
-
FunctionDef
-
FunctionDef
-
FunctionDef
-
FunctionDef
public FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, String returnTypeAnnotation, List<DecoratorDef> returnTypeDecorators) -
FunctionDef
public FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract) -
FunctionDef
public FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract, boolean isStatic) -
FunctionDef
public FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract, boolean isStatic, boolean isAsync) -
FunctionDef
public 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) -
FunctionDef
public FunctionDef(String name, ArgumentsDef arguments, List<DecoratorDef> decorators, ReturnDef returnType, String typeComment, List<TypeVar> typeParams, String documentation, boolean isAbstract, boolean isStatic, ClassDef declaringClass)
-
-
Method Details
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
hashCode
-
returnType
Get the parsed return type as ReturnDef. -
withClassDef
-
toString
-
name
Returns the value of thenamerecord component.- Specified by:
namein interfaceElementDef- Returns:
- the value of the
namerecord component
-
arguments
-
decorators
Returns the value of thedecoratorsrecord component.- Specified by:
decoratorsin interfaceElementDef- Returns:
- the value of the
decoratorsrecord component
-
typeComment
Returns the value of thetypeCommentrecord component.- Returns:
- the value of the
typeCommentrecord component
-
typeParams
Returns the value of thetypeParamsrecord component.- Returns:
- the value of the
typeParamsrecord component
-
documentation
Returns the value of thedocumentationrecord component.- Returns:
- the value of the
documentationrecord component
-
isAbstract
public boolean isAbstract()Returns the value of theisAbstractrecord component.- Returns:
- the value of the
isAbstractrecord component
-
isStatic
-
isAsync
-
hasReturnValue
public boolean hasReturnValue()Returns the value of thehasReturnValuerecord component.- Returns:
- the value of the
hasReturnValuerecord component
-
declaringClass
Returns the value of thedeclaringClassrecord component.- Specified by:
declaringClassin interfaceMemberDef- Returns:
- the value of the
declaringClassrecord component
-