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 explicit None.
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 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
    • of

      public static ArgumentDef of(String name, TypeRef typeAnnotation)
      Creates an argument definition.
      Parameters:
      name - The parameter name
      typeAnnotation - The type annotation (nullable)
      Returns:
      A new ArgumentDef
    • of

      public static ArgumentDef of(String name)
      Creates an argument definition with name only.
      Parameters:
      name - The parameter name
      Returns:
      A new ArgumentDef
    • of

      public static ArgumentDef of(String name, TypeRef typeAnnotation, Object defaultValue)
      Creates an argument definition with name, type, and default value.
      Parameters:
      name - The parameter name
      typeAnnotation - 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 name
      typeAnnotation - 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 name
      annotation - 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 name
      annotation - The full annotation string (nullable)
      typeAnnotation - The extracted type annotation (nullable)
      defaultValue - The default value (nullable)
      hasDefaultValue - Whether a default value was declared
      decorators - The decorators (nullable)
      documentation - The parameter documentation (nullable)
      Returns:
      A new ArgumentDef
    • withDeclaringFunction

      public ArgumentDef withDeclaringFunction(FunctionDef declaringFunction)
      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

      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
    • annotation

      public String annotation()
      Returns the value of the annotation record component.
      Returns:
      the value of the annotation record component
    • typeAnnotation

      public TypeRef typeAnnotation()
      Returns the value of the typeAnnotation record component.
      Returns:
      the value of the typeAnnotation record component
    • defaultValue

      public Object defaultValue()
      Returns the value of the defaultValue record component.
      Returns:
      the value of the defaultValue record component
    • hasDefaultValue

      public boolean hasDefaultValue()
      Returns the value of the hasDefaultValue record component.
      Returns:
      the value of the hasDefaultValue 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
    • documentation

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

      public FunctionDef declaringFunction()
      Returns the value of the declaringFunction record component.
      Returns:
      the value of the declaringFunction record component