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 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. All components in this record class are compared with Objects::equals(Object,Object).
      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
    • 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

      public PropertyDef withGetter(FunctionDef getter)
      Creates a new PropertyDef with the given getter.
    • withSetter

      public PropertyDef withSetter(FunctionDef setter)
      Creates a new PropertyDef with the given setter.
    • withDeleter

      public PropertyDef withDeleter(FunctionDef deleter)
      Creates a new PropertyDef with the given deleter.
    • withField

      public PropertyDef withField(AttributeDef field)
      Creates a new PropertyDef with the given field.
    • withDecorators

      public PropertyDef withDecorators(List<DecoratorDef> decorators)
      Creates a new PropertyDef with the given decorators.
    • withDeclaringClass

      public PropertyDef withDeclaringClass(ClassDef declaringClass)
      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

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

      public FunctionDef getter()
      Returns the value of the getter record component.
      Returns:
      the value of the getter record component
    • setter

      public FunctionDef setter()
      Returns the value of the setter record component.
      Returns:
      the value of the setter record component
    • deleter

      public FunctionDef deleter()
      Returns the value of the deleter record component.
      Returns:
      the value of the deleter record component
    • field

      public AttributeDef field()
      Returns the value of the field record component.
      Returns:
      the value of the field 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
    • declaringClass

      public ClassDef declaringClass()
      Returns the value of the declaringClass record component.
      Returns:
      the value of the declaringClass record component