ModelClassDefinition class final
A ClassDefinition specialization that represents a model class.
- Inheritance
-
- Object
- SerializableModelDefinition
- ClassDefinition
- ModelClassDefinition
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, String? tableName, List<SerializableModelIndexDefinition> indexes = const [], List<String> subDirParts = const [], List<String> ? documentation}) - Create a new ModelClassDefinition.
Properties
-
childClasses
↔ List<
InheritanceDefinition> -
If set to a List of
InheritanceDefinitionsthe class is a parent class and stores the child classes.getter/setter pair - className → String
-
finalinherited
-
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 setter
-
documentation
→ List<
String> ? -
The documentation of this class, line by line.
finalinherited
- everyParentIsSealed → bool
-
Returns
trueif all parent classes are sealed. Returnstrueif the class does not have a parent class.no setter - extendsClass ↔ InheritanceDefinition?
-
If set to
InheritanceDefinitionsthe class extends another class and stores the ClassDefinition of it's parent.getter/setter pair -
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, is always included at the beginning of the list.
no setter
- fileName → String
-
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- idField → SerializableModelFieldDefinition
-
Returns the
SerializableModelFieldDefinitionof 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 setter
-
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
trueif 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
trueif this class is a parent class or sealed.no setter - isSealed → bool
-
If set to true the class is sealed.
final
- isSealedTopNode → bool
-
Returns
trueif this class is the top node of a sealed hierarchy.no setter - manageMigration → bool
-
final
- parentClass → ModelClassDefinition?
-
Returns the
ModelClassDefinitionof the parent class. If there is no parent class,nullis returned.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sealedTopNode → ClassDefinition?
-
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,
nullis returned.no setter - serverOnly → bool
-
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
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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited