Record Class AttributeDef

java.lang.Object
java.lang.Record
io.micronaut.python.processing.visitor.AttributeDef
Record Components:
name - The name of the attribute.
annotation - The full type annotation string.
typeName - The extracted type name (e.g., TypeRef for "List[str]").
value - The default value.
hasDefaultValue - Whether the attribute declaration includes a default value, including an explicit None.
decorators - The decorators.
documentation - The documentation string.
isStatic - Whether the attribute is static (class-level).
declaringClass - The class that declares this attribute.
defaultFactoryName - The dataclass default factory function name, when declared through field(default_factory=...).
All Implemented Interfaces:
ElementDef, MemberDef

public record AttributeDef(String name, String annotation, TypeRef typeName, org.graalvm.polyglot.Value value, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation, boolean isStatic, ClassDef declaringClass, String defaultFactoryName) extends Record implements ElementDef, MemberDef
An AttributeDef node represents a class attribute definition.

AttributeDef(identifier name, expr? annotation, expr? value, list[DecoratorDef] decorators, str? documentation, bool isStatic, TypeRef? typeName, ClassDef declaringClass)

See Also:
  • Constructor Details

    • AttributeDef

      public AttributeDef(String name)
    • AttributeDef

      public AttributeDef(String name, String annotation, org.graalvm.polyglot.Value value)
    • AttributeDef

      public AttributeDef(String name, String annotation, TypeRef typeName, org.graalvm.polyglot.Value value, List<DecoratorDef> decorators, String documentation, boolean isStatic, ClassDef declaringClass)
    • AttributeDef

      public AttributeDef(String name, String annotation, TypeRef typeName, org.graalvm.polyglot.Value value, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation, boolean isStatic, ClassDef declaringClass)
    • AttributeDef

      public AttributeDef(String name, String annotation, TypeRef typeName, org.graalvm.polyglot.Value value, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation, boolean isStatic, ClassDef declaringClass, String defaultFactoryName)
      Creates an instance of a AttributeDef record class.
      Parameters:
      name - the value for the name record component
      annotation - the value for the annotation record component
      typeName - the value for the typeName record component
      value - the value for the value record component
      hasDefaultValue - the value for the hasDefaultValue record component
      decorators - the value for the decorators record component
      documentation - the value for the documentation record component
      isStatic - the value for the isStatic record component
      declaringClass - the value for the declaringClass record component
      defaultFactoryName - the value for the defaultFactoryName record component
  • Method Details

    • withDeclaringClass

      public AttributeDef withDeclaringClass(ClassDef declaringClass)
      Creates a new AttributeDef with the given declaring class.
      Parameters:
      declaringClass - The class that declares this attribute
      Returns:
      A new AttributeDef with the declaring class set
    • 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
    • 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
    • typeName

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

      public org.graalvm.polyglot.Value value()
      Returns the value of the value record component.
      Returns:
      the value of the value 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
    • isStatic

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

      public String defaultFactoryName()
      Returns the value of the defaultFactoryName record component.
      Returns:
      the value of the defaultFactoryName record component