Domain objects in the DSL can allow access to their fields through projections.
Domain objects in the DSL can allow access to their fields through projections.
Domain objects in the DSL can allow access to their fields through projections. This trait signals the support of field projections and provides a convenience method to create these projections. This trait is meant for Lists of objects to project a List of traits back.
Here's an example:
case class Person(val name: String) class PersonFieldListProjections(personFact: ListFact[Person]) extends ProjectableListFields[Person] { def outerFact: Fact[Person] = personFact def name: DslEvaluation[String] = projectField( _.name ) } object PersonImplicits { implicit def toPersonFieldListProjections(personFact: ListFact[Person]): PersonListFieldProjections = new PersonListFieldProjections(personFact) }
With these elements in place, you can import the PersonImplicits._ where you want to use it in your
DSL and you can refer to the name
field of any Fact
of type Person
.
type from which the field(s) can be projected.
Domain objects in the DSL can allow access to their fields through projections. This trait signals the support of field projections and provides a convenience method to create these projections.
Here's an example:
With these elements in place, you can import the PersonImplicits._ where you want to use it in your DSL and you can refer to the
name
field of anyFact
of typePerson
.type from which the field(s) can be projected.