Record Class ClassDef

java.lang.Object
java.lang.Record
io.micronaut.python.processing.visitor.ClassDef
Record Components:
name - The name of the class.
packageName - The package name of the class.
bases - The base classes with their type arguments.
decorators - The decorators.
typeParams - The type parameters.
functions - The functions defined in the class.
attributes - The attributes defined in the class.
properties - The properties defined in the class.
nestedClasses - The direct nested classes defined in the class.
constructor - The constructor function (__init__) if present.
frozenDataclass - Whether this class is a Python dataclass with frozen=True.
isEnum - Whether this class is an enum.
values - The enum values if this is an enum.
documentation - The class documentation string.
All Implemented Interfaces:
ElementDef

public record ClassDef(String name, String packageName, List<TypeRef> bases, List<DecoratorDef> decorators, List<TypeVar> typeParams, List<FunctionDef> functions, List<AttributeDef> attributes, List<PropertyDef> properties, List<ClassDef> nestedClasses, FunctionDef constructor, boolean frozenDataclass, boolean isEnum, List<String> values, String documentation) extends Record implements ElementDef
A ClassDef node represents a class definition.

ClassDef(identifier name, list[expr] bases, list[keyword] keywords, list[stmt] body, list[FunctionDef] decorator_list, list[TypeVar] type_params, list[AttributeDef] attributes, list[PropertyDef] properties)

See Also:
  • Constructor Details

  • Method Details

    • withConstructor

      public ClassDef withConstructor(FunctionDef constructor)
    • withFunction

      public ClassDef withFunction(FunctionDef function)
    • withAttribute

      public ClassDef withAttribute(AttributeDef attribute)
    • withProperty

      public ClassDef withProperty(PropertyDef property)
    • withNestedClass

      public ClassDef withNestedClass(ClassDef nestedClass)
    • withEnum

      public ClassDef withEnum(boolean isEnum, List<String> values)
    • withFrozenDataclass

      public ClassDef withFrozenDataclass(boolean frozenDataclass)
    • qualifiedName

      public String qualifiedName()
    • 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
    • packageName

      public String packageName()
      Returns the value of the packageName record component.
      Returns:
      the value of the packageName record component
    • bases

      public List<TypeRef> bases()
      Returns the value of the bases record component.
      Returns:
      the value of the bases 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
    • typeParams

      public List<TypeVar> typeParams()
      Returns the value of the typeParams record component.
      Returns:
      the value of the typeParams record component
    • functions

      public List<FunctionDef> functions()
      Returns the value of the functions record component.
      Returns:
      the value of the functions record component
    • attributes

      public List<AttributeDef> attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component
    • properties

      public List<PropertyDef> properties()
      Returns the value of the properties record component.
      Returns:
      the value of the properties record component
    • nestedClasses

      public List<ClassDef> nestedClasses()
      Returns the value of the nestedClasses record component.
      Returns:
      the value of the nestedClasses record component
    • constructor

      public FunctionDef constructor()
      Returns the value of the constructor record component.
      Returns:
      the value of the constructor record component
    • frozenDataclass

      public boolean frozenDataclass()
      Returns the value of the frozenDataclass record component.
      Returns:
      the value of the frozenDataclass record component
    • isEnum

      public boolean isEnum()
      Returns the value of the isEnum record component.
      Returns:
      the value of the isEnum record component
    • values

      public List<String> values()
      Returns the value of the values record component.
      Returns:
      the value of the values record component
    • documentation

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