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 Summary
ConstructorsConstructorDescriptionClassDef(String name, String packageName, List<TypeRef> bases, List<DecoratorDef> decorators, List<TypeVar> typeParams, List<FunctionDef> functions, List<AttributeDef> attributes, List<PropertyDef> properties, FunctionDef constructor, boolean frozenDataclass, boolean isEnum, List<String> values, String documentation) ClassDef(String name, String packageName, List<TypeRef> bases, List<DecoratorDef> decorators, List<TypeVar> typeParams, List<FunctionDef> functions, List<AttributeDef> attributes, List<PropertyDef> properties, FunctionDef constructor, boolean isEnum, List<String> values, String documentation) 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) Creates an instance of aClassDefrecord class.ClassDef(String name, List<DecoratorDef> decoratorList) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributesrecord component.bases()Returns the value of thebasesrecord component.Returns the value of theconstructorrecord component.Returns the value of thedecoratorsrecord component.Returns the value of thedocumentationrecord component.booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of thefrozenDataclassrecord component.Returns the value of thefunctionsrecord component.inthashCode()Returns a hash code value for this object.booleanisEnum()Returns the value of theisEnumrecord component.name()Returns the value of thenamerecord component.Returns the value of thenestedClassesrecord component.Returns the value of thepackageNamerecord component.Returns the value of thepropertiesrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetypeParamsrecord component.values()Returns the value of thevaluesrecord component.withAttribute(AttributeDef attribute) withConstructor(FunctionDef constructor) withFrozenDataclass(boolean frozenDataclass) withFunction(FunctionDef function) withNestedClass(ClassDef nestedClass) withProperty(PropertyDef property)
-
Constructor Details
-
ClassDef
public 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) Creates an instance of aClassDefrecord class.- Parameters:
name- the value for thenamerecord componentpackageName- the value for thepackageNamerecord componentbases- the value for thebasesrecord componentdecorators- the value for thedecoratorsrecord componenttypeParams- the value for thetypeParamsrecord componentfunctions- the value for thefunctionsrecord componentattributes- the value for theattributesrecord componentproperties- the value for thepropertiesrecord componentnestedClasses- the value for thenestedClassesrecord componentconstructor- the value for theconstructorrecord componentfrozenDataclass- the value for thefrozenDataclassrecord componentisEnum- the value for theisEnumrecord componentvalues- the value for thevaluesrecord componentdocumentation- the value for thedocumentationrecord component
-
ClassDef
public ClassDef(String name, String packageName, List<TypeRef> bases, List<DecoratorDef> decorators, List<TypeVar> typeParams, List<FunctionDef> functions, List<AttributeDef> attributes, List<PropertyDef> properties, FunctionDef constructor, boolean isEnum, List<String> values, String documentation) -
ClassDef
public ClassDef(String name, String packageName, List<TypeRef> bases, List<DecoratorDef> decorators, List<TypeVar> typeParams, List<FunctionDef> functions, List<AttributeDef> attributes, List<PropertyDef> properties, FunctionDef constructor, boolean frozenDataclass, boolean isEnum, List<String> values, String documentation) -
ClassDef
-
ClassDef
-
-
Method Details
-
withConstructor
-
withFunction
-
withAttribute
-
withProperty
-
withNestedClass
-
withEnum
-
withFrozenDataclass
-
qualifiedName
-
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
-
packageName
Returns the value of thepackageNamerecord component.- Returns:
- the value of the
packageNamerecord component
-
bases
-
decorators
Returns the value of thedecoratorsrecord component.- Specified by:
decoratorsin interfaceElementDef- Returns:
- the value of the
decoratorsrecord component
-
typeParams
Returns the value of thetypeParamsrecord component.- Returns:
- the value of the
typeParamsrecord component
-
functions
-
attributes
Returns the value of theattributesrecord component.- Returns:
- the value of the
attributesrecord component
-
properties
Returns the value of thepropertiesrecord component.- Returns:
- the value of the
propertiesrecord component
-
nestedClasses
Returns the value of thenestedClassesrecord component.- Returns:
- the value of the
nestedClassesrecord component
-
constructor
Returns the value of theconstructorrecord component.- Returns:
- the value of the
constructorrecord component
-
frozenDataclass
public boolean frozenDataclass()Returns the value of thefrozenDataclassrecord component.- Returns:
- the value of the
frozenDataclassrecord component
-
isEnum
-
values
-
documentation
Returns the value of thedocumentationrecord component.- Returns:
- the value of the
documentationrecord component
-