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. Entities
  2. IterableEntity & Iterable2Entity

The Type Template

PreviousIterableEntity / Iterable2Entity kindsNextCreating an IterableEntity / Iterable2Entity

An IterableEntity or Iterable2Entity have only one member parameter, which is the collection of modddels. For example, a 'BookList' ListEntity will have one member parameter List<Book> books.

The TypeTemplate is the template that the type of the member parameter should match. Every IterableEntity/Iterable2Entity kind has a type template .

For example, the type template of a MapEntity (which is an Iterable2Entity) is 'Map<#1,#2>' :

  • #1 and #2 are masks. #1 matches the first modddel type of the MapEntity, and #2 matches the second modddel type.

  • So this type template would match for example : Map<Username, Password>.

Let's take another example : the type template of a MappedValuesEntity (which is an IterableEntity) is Map<*,#1> :

  • The * is a wildcard : it matches any type argument.

  • The #1 is a mask : it matches the modddel type of the MappedValuesEntity.

  • So this type template would match for example : Map<int, Person> and Map<String, Person>.

(See the tables in the previous page)