Record Class PropertyDef
java.lang.Object
java.lang.Record
io.micronaut.python.processing.visitor.PropertyDef
- Record Components:
name- The name of the property.getter- The getter method (@property decorated function).setter- The setter method (@property.setter decorated function).deleter- The deleter method (@property.deleter decorated function).field- The associated field if this property is field-backed.decorators- The decorators applied to this property.declaringClass- The class that declares this property.
- All Implemented Interfaces:
ElementDef
public record PropertyDef(String name, FunctionDef getter, FunctionDef setter, FunctionDef deleter, AttributeDef field, List<DecoratorDef> decorators, ClassDef declaringClass)
extends Record
implements ElementDef
A PropertyDef node represents a Python property definition.
PropertyDef(identifier name, FunctionDef getter, FunctionDef setter, FunctionDef deleter, AttributeDef field, list[DecoratorDef] decorators, ClassDef declaringClass)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyDef(String name) PropertyDef(String name, FunctionDef getter) PropertyDef(String name, FunctionDef getter, FunctionDef setter, FunctionDef deleter, AttributeDef field, List<DecoratorDef> decorators, ClassDef declaringClass) Creates an instance of aPropertyDefrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedeclaringClassrecord component.Returns the value of thedecoratorsrecord component.deleter()Returns the value of thedeleterrecord component.booleanIndicates whether some other object is "equal to" this one.field()Returns the value of thefieldrecord component.getter()Returns the value of thegetterrecord component.booleanReturns true if this property has a deleter method.booleanhasField()Returns true if this property is backed by a field.booleanReturns true if this property has a getter method.inthashCode()Returns a hash code value for this object.booleanReturns true if this property has a setter method.booleanReturns true if this is a read-only property (has getter but no setter).booleanReturns true if this is a write-only property (no getter but has setter).name()Returns the value of thenamerecord component.setter()Returns the value of thesetterrecord component.final StringtoString()Returns a string representation of this record class.withDeclaringClass(ClassDef declaringClass) Creates a new PropertyDef with the given declaring class.withDecorators(List<DecoratorDef> decorators) Creates a new PropertyDef with the given decorators.withDeleter(FunctionDef deleter) Creates a new PropertyDef with the given deleter.withField(AttributeDef field) Creates a new PropertyDef with the given field.withGetter(FunctionDef getter) Creates a new PropertyDef with the given getter.withSetter(FunctionDef setter) Creates a new PropertyDef with the given setter.
-
Constructor Details
-
PropertyDef
public PropertyDef(String name, FunctionDef getter, FunctionDef setter, FunctionDef deleter, AttributeDef field, List<DecoratorDef> decorators, ClassDef declaringClass) Creates an instance of aPropertyDefrecord class.- Parameters:
name- the value for thenamerecord componentgetter- the value for thegetterrecord componentsetter- the value for thesetterrecord componentdeleter- the value for thedeleterrecord componentfield- the value for thefieldrecord componentdecorators- the value for thedecoratorsrecord componentdeclaringClass- the value for thedeclaringClassrecord component
-
PropertyDef
-
PropertyDef
-
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
hashCode
-
hasGetter
public boolean hasGetter()Returns true if this property has a getter method. -
hasSetter
public boolean hasSetter()Returns true if this property has a setter method. -
hasDeleter
public boolean hasDeleter()Returns true if this property has a deleter method. -
hasField
public boolean hasField()Returns true if this property is backed by a field. -
isReadOnly
public boolean isReadOnly()Returns true if this is a read-only property (has getter but no setter). -
isWriteOnly
public boolean isWriteOnly()Returns true if this is a write-only property (no getter but has setter). -
withGetter
Creates a new PropertyDef with the given getter. -
withSetter
Creates a new PropertyDef with the given setter. -
withDeleter
Creates a new PropertyDef with the given deleter. -
withField
Creates a new PropertyDef with the given field. -
withDecorators
Creates a new PropertyDef with the given decorators. -
withDeclaringClass
Creates a new PropertyDef with the given declaring class.- Parameters:
declaringClass- The class that declares this property- Returns:
- A new PropertyDef with the declaring class set
-
toString
-
name
Returns the value of thenamerecord component.- Specified by:
namein interfaceElementDef- Returns:
- the value of the
namerecord component
-
getter
-
setter
-
deleter
-
field
-
decorators
Returns the value of thedecoratorsrecord component.- Specified by:
decoratorsin interfaceElementDef- Returns:
- the value of the
decoratorsrecord component
-
declaringClass
Returns the value of thedeclaringClassrecord component.- Returns:
- the value of the
declaringClassrecord component
-