ModelClassDefinition class final

A ClassDefinition specialization that represents a model class.

Inheritance

Constructors

ModelClassDefinition({required String fileName, required String sourceFileName, required String className, required List<SerializableModelFieldDefinition> fields, required bool serverOnly, required bool manageMigration, required TypeDefinition type, required bool isSealed, required bool isImmutable, List<InheritanceDefinition>? childClasses, InheritanceDefinition? extendsClass, ModelDatabaseDefinition database = ModelDatabaseDefinition.server, String? tableName, SerializationDataType? serializationDataType, List<SerializableModelIndexDefinition> indexes = const [], List<String> subDirParts = const [], List<String>? documentation, String? sharedPackageName})
Create a new ModelClassDefinition.

Properties

childClasses List<InheritanceDefinition>
If set to a List of InheritanceDefinition the class is a parent class that stores the child classes.
getter/setter pairinherited
className String
finalinherited
database → ModelDatabaseDefinition
Determines where table-backed database code should be generated.
final
descendantClasses List<ModelClassDefinition>
Returns a list of all descendant classes. This includes all child classes and their descendants. If the class has no child classes, an empty list is returned.
no setteroverride
documentation List<String>?
The documentation of this class, line by line.
finalinherited
everyParentIsSealed bool
Returns true if all parent classes are sealed. Returns true if the class does not have a parent class.
no setterinherited
extendsClass ↔ InheritanceDefinition?
If set to InheritanceDefinition the class extends another class and stores the ClassDefinition of its parent.
getter/setter pairinherited
fields List<SerializableModelFieldDefinition>
The fields of this class / exception.
getter/setter pairinherited
fieldsIncludingInherited List<SerializableModelFieldDefinition>
Returns a list of all fields in this class, including inherited fields. It ensures that the 'id' field, if present on this class, is always included at the beginning of the list. Non-tail fields are ordered top-down through the inheritance chain. Tail fields are ordered bottom-up so that root parent tail fields appear last.
no setteroverride
fileName String
finalinherited
hashCode int
The hash code for this object.
no setterinherited
idField SerializableModelFieldDefinition
Returns the SerializableModelFieldDefinition of the 'id' field. If the field is not present, an error is thrown.
no setter
indexes List<SerializableModelIndexDefinition>
The indexes that should be created for the table tableName representing this class.
final
indexesIncludingInherited List<SerializableModelIndexDefinition>
Returns a list of all indexes in this class, including inherited indexes.
no setter
inheritedFields List<SerializableModelFieldDefinition>
Returns a list of all fields in the parent class. If there is no parent class, an empty list is returned. Excludes the id field, as it is re-declared on child classes.
no setteroverride
inheritedIndexes List<SerializableModelIndexDefinition>
Returns a list of all indexes declared in the parent class. If there is no parent class, an empty list is returned. Inherited indexes act as index generators for child classes. They are created with the table name as prefix to the original name.
no setter
isIdInherited bool
Returns true if the 'id' field is inherited from a parent class.
no setter
isImmutable bool
If set to true the class is immutable.
final
isParentClass bool
Returns true if this class is a parent class or sealed.
no setterinherited
isSealed bool
If set to true the class is sealed.
finalinherited
isSealedTopNode bool
Returns true if this class is the top node of a sealed hierarchy.
no setterinherited
isSharedModel bool
Whether this model is declared in a shared package. Such models are not generated on the server or client side, but on its own shared package.
no setterinherited
manageMigration bool
final
parentClass ModelClassDefinition?
Returns the ClassDefinition of the parent class. If there is no parent class, null is returned.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sealedTopNode ModelClassDefinition?
Returns the top node of the sealed hierarchy. If the class is the top node it returns itself. If the class is not part of a sealed hierarchy, null is returned.
no setteroverride
serializationDataType → SerializationDataType?
If set, the default data type used for serialization of the JSON columns in this class. It can be overridden for each field.
final
serverOnly bool
finalinherited
sharedPackageName String?
finalinherited
sourceFileName String
finalinherited
subDirParts List<String>
finalinherited
tableName String?
If set, the name of the table, this class should be stored in, in the database.
final
type TypeDefinition
finalinherited
typeName String
Returns the type name used in validation messages.
no setterinherited

Methods

fileRef() String
Generate the file reference String to this file.
inherited
findField(String name) SerializableModelFieldDefinition?
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldGenerateTableCode(bool serverCode) bool
Returns true if database code should be generated for the specified side.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited