Package

org.scalarules.dsl.core

projections

Permalink

package projections

Visibility
  1. Public
  2. All

Type Members

  1. trait ProjectableFields[C] extends AnyRef

    Permalink

    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.

    Here's an example:

    case class Person(val name: String)
    
    class PersonFieldProjections(personFact: SingularFact[Person]) extends ProjectableFields[Person] {
      def outerFact: Fact[Person] = personFact
    
      def name: DslEvaluation[String] = projectField( _.name )
    }
    
    object PersonImplicits {
      implicit def toPersonFieldProjections(personFact: SingularFact[Person]): PersonFieldProjections = new PersonFieldProjections(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.

    C

    type from which the field(s) can be projected.

  2. trait ProjectableListFields[C] extends AnyRef

    Permalink

    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.

    C

    type from which the field(s) can be projected.

  3. class ProjectedDslEvaluation[C, F] extends DslEvaluation[List[F]]

    Permalink

Ungrouped