molecule

package molecule

Members list

Packages

package molecule.base

Type members

Classlikes

abstract class DomainStructure

Domain structure definition

Domain structure definition

Define a Domain structure to be handled by Molecule in an object that extends this DomainStructure class.

A domain structure consists of traits describing real world entities. Each entity/trait is given a name and defines a list of attributes that are the relevant properties of the entity.

package path.to.your.project
import molecule.Domain

object Community extends Domain { // "Community" domain

 trait Person {          // "Person" entity
   val name = oneString  // Person "name" String attribute definition
   val age  = oneInt     // Person "age" Int attribute definition
 }

 // Additional entities...
}

For larger projects, it is recommended to organize the domain structure in segments of related entity traits within objects:

object Seattle extends DomainStructure {

 object customer { // "customer" segment
   trait Person {
     val name    = oneString
     val age     = oneInt
     val address = one[Address]         // Cardinality-one relationship to Address
     val bought  = many[products.Item]  // Cardinality-many relationship to products.Item
   }
   trait Address {
     val street = oneString
     val city   = oneInt
   }
   // ..more entities in the `customer` segment
 }

 object products { // "products" segment
   trait Item {
     val title   = oneString
     val inStock = oneInt
   }
   // ..more entities in the `products` segment
 }

 // Additional segments...
}

Attributes

Source
DomainStructure.scala
Supertypes
class Object
trait Matchable
class Any
abstract class Graphql(urlOrSchemaFilePath: String)

Attributes

Source
Graphql.scala
Supertypes
class Object
trait Matchable
class Any
abstract class REST(maxArity: Int, urlOrSchemaFilePath: String)

Attributes

Source
REST.scala
Supertypes
class Object
trait Matchable
class Any