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 explicitNone.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 throughfield(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 Summary
ConstructorsConstructorDescriptionAttributeDef(String name) AttributeDef(String name, String annotation, TypeRef typeName, org.graalvm.polyglot.Value value, boolean hasDefaultValue, List<DecoratorDef> decorators, String documentation, boolean isStatic, ClassDef declaringClass) 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 aAttributeDefrecord class.AttributeDef(String name, String annotation, TypeRef typeName, org.graalvm.polyglot.Value value, List<DecoratorDef> decorators, String documentation, boolean isStatic, ClassDef declaringClass) AttributeDef(String name, String annotation, org.graalvm.polyglot.Value value) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theannotationrecord component.Returns the value of thedeclaringClassrecord component.Returns the value of thedecoratorsrecord component.Returns the value of thedefaultFactoryNamerecord 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.booleanisStatic()Returns the value of theisStaticrecord component.name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.typeName()Returns the value of thetypeNamerecord component.org.graalvm.polyglot.Valuevalue()Returns the value of thevaluerecord component.withDeclaringClass(ClassDef declaringClass) Creates a new AttributeDef with the given declaring class.
-
Constructor Details
-
AttributeDef
-
AttributeDef
-
AttributeDef
-
AttributeDef
-
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 aAttributeDefrecord class.- Parameters:
name- the value for thenamerecord componentannotation- the value for theannotationrecord componenttypeName- the value for thetypeNamerecord componentvalue- the value for thevaluerecord componenthasDefaultValue- the value for thehasDefaultValuerecord componentdecorators- the value for thedecoratorsrecord componentdocumentation- the value for thedocumentationrecord componentisStatic- the value for theisStaticrecord componentdeclaringClass- the value for thedeclaringClassrecord componentdefaultFactoryName- the value for thedefaultFactoryNamerecord component
-
-
Method Details
-
withDeclaringClass
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
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
-
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
-
typeName
-
value
-
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
-
isStatic
-
declaringClass
Returns the value of thedeclaringClassrecord component.- Specified by:
declaringClassin interfaceMemberDef- Returns:
- the value of the
declaringClassrecord component
-
defaultFactoryName
Returns the value of thedefaultFactoryNamerecord component.- Returns:
- the value of the
defaultFactoryNamerecord component
-