Modddels
HomeGithubPub.dev
v0.2
v0.2
  • Motivation
  • Setup
  • Generalities
    • Modddels Overview
    • Validations & Validation steps
    • Structure of a Modddel
    • Member parameters & Dependency parameters
    • Usage
      • Data equality & toString
      • Pattern matching
      • Reading the fields
      • Reading the failures
      • CopyWith
  • ValueObjects
    • ValueObjects Overview
    • Creating a ValueObject
  • Entities
    • Entities Overview
    • ContentValidation & ContentFailure
    • ValidationSteps in Entities
    • SimpleEntity
      • Creating a SimpleEntity
      • Special Cases
    • IterableEntity & Iterable2Entity
      • IterableEntity / Iterable2Entity kinds
      • The Type Template
      • Creating an IterableEntity / Iterable2Entity
      • InvalidMembers Description
      • Special Cases
      • Creating your own IterableEntity / Iterable2Entity kind
  • Advanced Notions
    • The NullFailure Annotation
    • Using multiple parameters annotations
    • Class Hierarchy of ValueObjects
    • Class Hierarchy of Entities
    • Models that are always valid / invalid
  • Union of Modddels
    • Union of Modddels Overview
    • Basic Usage
    • Case-modddels pattern matching
    • Default Factory Constructor
    • Shared Properties
    • The Validate Methods
    • CopyWith
  • Unit-Testing Of Modddels
    • Unit-Testing Overview
    • Available Tests
    • Customizing Tests
  • Additional Information
    • Using type aliases
    • Re-running the generator
    • All Available Modddels
    • VsCode Snippets
Powered by GitBook
On this page
  1. Advanced Notions

Class Hierarchy of Entities

PreviousClass Hierarchy of ValueObjectsNextModels that are always valid / invalid

Let's say you want to create a Person Entity. Person will either directly extend SimpleEntity, or it will extend a subclass of IterableEntity or Iterable2Entity. They are all subclasses of Entity, which is a subclass of BaseModddel (the base class of all Modddels).

ValidPerson, which extends Person, will implement ValidEntity, which implements ValidModddel.

InvalidPerson, which extends Person, will implement InvalidEntity, which implements InvalidModddel.

NB 1 : The generated classes (Person, InvalidPerson...) will define other properties and methods than the ones already defined by the superclasses. (Ex: map, maybeMap, copyWith... and all the others)

NB 2 : Notice how there is no association between ValidModddel/InvalidModddel and BaseModddel, and also no association between ValidEntity/InvalidEntity and Entity. That's on purpose because those interfaces can be directly implemented in some cases, and we don't want the BaseModddel methods to be inherited. (See the section).

models that are always valid / invalid
Class Hierarchy of Entities I: The type of the generated invalid modddel - V: The type of the generated valid modddel