Skip to content

Complex types

Complex types represent structured data. The following model shows the most common field forms in one extractable example:

cmn
package com.example.customer

import org.joinedworkz.facilities.common.base

platform Base

type Address {
    city*: String
}

type Employee {
    id**: Id
    name*: String
}

type Person {
    firstName*: Name
    lastName*: Name
}

type Customer {
    id**: Id
    address: Address
    manager -> Employee
    orders: Id[]
    tags: String[0..*]
    translations: String[String]
}

type CustomerView {
    ...Person
    ...Customer exclude manager
}

Field forms

  • name*: String is a mandatory containment field.
  • id**: Id is a key field.
  • address: Address contains another complex type.
  • manager -> Employee references another complex type.
  • orders: Id[] is an unbounded collection.
  • tags: String[0..*] states the bounds explicitly.
  • translations: String[String] is a dictionary keyed by String.
  • ...Person includes fields from another type.
  • ...Customer exclude manager includes fields except the named field.

Without *, a field is optional. Cardinalities follow the referenced type.