Record Class ReturnDef
java.lang.Object
java.lang.Record
io.micronaut.python.processing.visitor.ReturnDef
- Record Components:
typeAnnotation- The return type annotation, or null if no return type is specified.decorators- The decorators found on the return type annotation.
- All Implemented Interfaces:
ElementDef
public record ReturnDef(TypeRef typeAnnotation, List<DecoratorDef> decorators)
extends Record
implements ElementDef
A ReturnDef represents the return type annotation of a function.
This record captures the return type annotation from a Python function's type hint (e.g., "-> int", "-> str", "-> List[str]").
- Since:
- 5.2.0
- Author:
- Micronaut Team
-
Constructor Summary
ConstructorsConstructorDescriptionReturnDef(TypeRef typeAnnotation, List<DecoratorDef> decorators) Creates an instance of aReturnDefrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedecoratorsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()static ReturnDefnone()Creates a ReturnDef with no return type annotation.static ReturnDefCreates a ReturnDef with the specified type annotation.static ReturnDefof(TypeRef typeAnnotation, List<DecoratorDef> decorators) Creates a ReturnDef with the specified type annotation and decorators.final StringtoString()Returns a string representation of this record class.Returns the value of thetypeAnnotationrecord component.
-
Constructor Details
-
ReturnDef
Creates an instance of aReturnDefrecord class.- Parameters:
typeAnnotation- the value for thetypeAnnotationrecord componentdecorators- the value for thedecoratorsrecord component
-
-
Method Details
-
none
Creates a ReturnDef with no return type annotation.- Returns:
- A new ReturnDef with null type annotation
-
of
-
of
Creates a ReturnDef with the specified type annotation and decorators.- Parameters:
typeAnnotation- The return type annotationdecorators- The decorators for the return type- Returns:
- A new ReturnDef
-
name
- Specified by:
namein interfaceElementDef
-
toString
-
hashCode
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
typeAnnotation
Returns the value of thetypeAnnotationrecord component.- Returns:
- the value of the
typeAnnotationrecord component
-
decorators
Returns the value of thedecoratorsrecord component.- Specified by:
decoratorsin interfaceElementDef- Returns:
- the value of the
decoratorsrecord component
-