Record Class ArgumentDef
java.lang.Object
java.lang.Record
io.micronaut.python.processing.visitor.ArgumentDef
- Record Components:
name- The parameter name.annotation- The full type annotation string.typeAnnotation- The extracted type annotation (e.g., TypeRef for "List[str]").defaultValue- The default value as a GraalPy Value, or null if no default.hasDefaultValue- Whether the parameter declaration includes a default value, including an explicitNone.decorators- The decorators applied to this parameter.documentation- The parameter documentation string.declaringFunction- The function that declares this argument.
- All Implemented Interfaces:
ElementDef
public record ArgumentDef(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation, FunctionDef declaringFunction)
extends Record
implements ElementDef
An ArgumentDef represents a single function parameter definition.
This record captures the details of a Python function argument including its name, type annotation, default value, decorators, and documentation.
- Since:
- 5.2.0
- Author:
- Micronaut Team
-
Constructor Summary
ConstructorsConstructorDescriptionArgumentDef(String name, TypeRef typeAnnotation) ArgumentDef(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation, FunctionDef declaringFunction) Creates an instance of aArgumentDefrecord class.ArgumentDef(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, List<DecoratorDef> decorators, String documentation) ArgumentDef(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, List<DecoratorDef> decorators, String documentation, FunctionDef declaringFunction) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theannotationrecord component.Returns the value of thedeclaringFunctionrecord component.Returns the value of thedecoratorsrecord component.Returns the value of thedefaultValuerecord component.Returns the value of thedocumentationrecord component.booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of thehasDefaultValuerecord component.inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.static ArgumentDefCreates an argument definition with name only.static ArgumentDefCreates an argument definition.static ArgumentDefCreates an argument definition with name, type, and default value.static ArgumentDefCreates an argument definition with name, type, default value, and documentation.static ArgumentDefof(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation) Creates an argument definition with explicit default presence metadata.static ArgumentDefof(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, List<DecoratorDef> decorators, String documentation) Creates an argument definition with annotation, type, decorators, and documentation.final StringtoString()Returns a string representation of this record class.Returns the value of thetypeAnnotationrecord component.withDeclaringFunction(FunctionDef declaringFunction) Creates a new ArgumentDef with the given declaring function.
-
Constructor Details
-
ArgumentDef
-
ArgumentDef
-
ArgumentDef
public ArgumentDef(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, List<DecoratorDef> decorators, String documentation, FunctionDef declaringFunction) -
ArgumentDef
public ArgumentDef(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation, FunctionDef declaringFunction) Creates an instance of aArgumentDefrecord class.- Parameters:
name- the value for thenamerecord componentannotation- the value for theannotationrecord componenttypeAnnotation- the value for thetypeAnnotationrecord componentdefaultValue- the value for thedefaultValuerecord componenthasDefaultValue- the value for thehasDefaultValuerecord componentdecorators- the value for thedecoratorsrecord componentdocumentation- the value for thedocumentationrecord componentdeclaringFunction- the value for thedeclaringFunctionrecord component
-
-
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
-
of
Creates an argument definition.- Parameters:
name- The parameter nametypeAnnotation- The type annotation (nullable)- Returns:
- A new ArgumentDef
-
of
Creates an argument definition with name only.- Parameters:
name- The parameter name- Returns:
- A new ArgumentDef
-
of
Creates an argument definition with name, type, and default value.- Parameters:
name- The parameter nametypeAnnotation- The type annotation (nullable)defaultValue- The default value (nullable)- Returns:
- A new ArgumentDef
-
of
public static ArgumentDef of(String name, TypeRef typeAnnotation, Object defaultValue, String documentation) Creates an argument definition with name, type, default value, and documentation.- Parameters:
name- The parameter nametypeAnnotation- The type annotation (nullable)defaultValue- The default value (nullable)documentation- The parameter documentation (nullable)- Returns:
- A new ArgumentDef
-
of
public static ArgumentDef of(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, List<DecoratorDef> decorators, String documentation) Creates an argument definition with annotation, type, decorators, and documentation.- Parameters:
name- The parameter nameannotation- The full annotation string (nullable)typeAnnotation- The extracted type annotation (nullable)defaultValue- The default value (nullable)decorators- The decorators (nullable)documentation- The parameter documentation (nullable)- Returns:
- A new ArgumentDef
-
of
public static ArgumentDef of(String name, String annotation, TypeRef typeAnnotation, Object defaultValue, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation) Creates an argument definition with explicit default presence metadata.- Parameters:
name- The parameter nameannotation- The full annotation string (nullable)typeAnnotation- The extracted type annotation (nullable)defaultValue- The default value (nullable)hasDefaultValue- Whether a default value was declareddecorators- The decorators (nullable)documentation- The parameter documentation (nullable)- Returns:
- A new ArgumentDef
-
withDeclaringFunction
Creates a new ArgumentDef with the given declaring function.- Parameters:
declaringFunction- The function that declares this argument- Returns:
- A new ArgumentDef with the declaring function set
-
toString
-
name
Returns the value of thenamerecord component.- Specified by:
namein interfaceElementDef- Returns:
- the value of the
namerecord component
-
annotation
Returns the value of theannotationrecord component.- Returns:
- the value of the
annotationrecord component
-
typeAnnotation
Returns the value of thetypeAnnotationrecord component.- Returns:
- the value of the
typeAnnotationrecord component
-
defaultValue
Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-
hasDefaultValue
public boolean hasDefaultValue()Returns the value of thehasDefaultValuerecord component.- Returns:
- the value of the
hasDefaultValuerecord component
-
decorators
Returns the value of thedecoratorsrecord component.- Specified by:
decoratorsin interfaceElementDef- Returns:
- the value of the
decoratorsrecord component
-
documentation
Returns the value of thedocumentationrecord component.- Returns:
- the value of the
documentationrecord component
-
declaringFunction
Returns the value of thedeclaringFunctionrecord component.- Returns:
- the value of the
declaringFunctionrecord component
-