Packages

p

longevity.model

annotations

package annotations

macro annotations for defining your domain model

Source
package.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. annotations
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. macro class component[M] extends Annotation with StaticAnnotation

    macro annotation to mark a class as a persistent component.

    macro annotation to mark a class as a persistent component. creates a companion object for the class that extends CType. if the class already has a companion object, then adds a parent class CType to the existing companion object. Note that this will not work if your companion object already extends an abstract or concrete class, as CType itself is an abstract class. if this happens, you will see a compiler error such as "class Foo needs to be a trait to be mixed in".

    M

    the model

    Annotations
    @compileTimeOnly( ... )
  2. macro class derivedComponent[M, Poly] extends Annotation with StaticAnnotation

    macro annotation to mark a class or object as a derived persistent component.

    macro annotation to mark a class or object as a derived persistent component. creates a companion object for the class that extends DerivedCType. if the class already has a companion object, then adds a parent class DerivedCType to the existing companion object. Note that this will not work if your companion object already extends an abstract or concrete class, as DerivedCType itself is an abstract class. if this happens, you will see a compiler error such as "class Foo needs to be a trait to be mixed in".

    if the annotated component is already an object, we create the DerivedCType as an internal object ctype.

    M

    the model

    Poly

    the type of the polymorphic component that this component is derived from

    Annotations
    @compileTimeOnly( ... )
  3. macro class derivedPersistent[M, Poly] extends Annotation with StaticAnnotation

    macro annotation to mark a class as a derived persistent component.

    macro annotation to mark a class as a derived persistent component. creates a companion object for the class that extends DerivedPType. if the class already has a companion object, then adds a parent class DerivedPType to the existing companion object.

    Note that, when using this annotation, an existing companion object cannot already extend a class other than DerivedPType or scala.AnyRef.

    M

    the model

    Poly

    the type of the polymorphic persistent that this persistent is derived from

    Annotations
    @compileTimeOnly( ... )
  4. macro class domainModel extends Annotation with StaticAnnotation

    macro annotation to mark a class or trait as a domain model.

    macro annotation to mark a class or trait as a domain model. adds two elements to the companion object of the annotated class:

    - implicit object modelType extends longevity.model.ModelType[M](currentPackage), - private[currentPackage] implicit object modelEv extends longevity.model.ModelEv[M]

    where M is the annotated class, and currentPackage is the package in which this annotation was applied.

    Annotations
    @compileTimeOnly( ... )
    See also

    longevity.model.ModelType

    longevity.model.ModelEv

  5. macro class keyVal[M, P] extends Annotation with StaticAnnotation

    macro annotation to mark a class as a key value.

    macro annotation to mark a class as a key value. extends the class with longevity.model.KeyVal[P].

    M

    the domain model

    P

    the persistent object that this type serves as a key value for

    Annotations
    @compileTimeOnly( ... )
  6. macro class mprops extends Annotation with StaticAnnotation

    macro annotation to generate a inner object props for your PType for you.

    macro annotation to generate a inner object props for your PType for you. Recursive members of the type P in PType[P] are mirrored in a structure of nested objects with type Prop[P, A](path) for appropriate values A and path.

    - case classes are traversed according to the parameters of their primary constructor - collection properties (Options, Sets, and Lists) are skipped - traits are traversed according to the abstract public vals they define. the traits themselves, however, are not mirrored as a Prop[P, A]

    NOTE: this traversal process will collect all valid properties for your PType. but be aware that the traversal can collect properties that are not actually valid. for example, it will freely traverse case class elements that appear to be persistent components, but are not included in your ModelType. it will also traverse persistent components that are otherwise illegal, such as those whose primary constructor has more than one parameter list. in all these cases, the property created by this macro will cause an exception to be thrown on model type construction. but all these cases, which represent a malformed domain model, would have otherwise produced exceptions on model type construction.

    Annotations
    @compileTimeOnly( ... )
  7. macro class pEv extends Annotation with StaticAnnotation

    macro annotation to generate a concrete definition of PType.pEv for you.

    macro annotation to generate a concrete definition of PType.pEv for you. This is roughly built as follows:

    implicit val pEv: longevity.model.PEv[M, P] = {
      import org.scalacheck.ScalacheckShapeless._
      implicit val arbJoda = com.fortysevendeg.scalacheck.datetime.joda.ArbitraryJoda.arbJoda
      new longevity.model.PEv[M, P]
    }
    Annotations
    @compileTimeOnly( ... )
  8. macro class persistent[M] extends Annotation with StaticAnnotation

    macro annotation to mark a class as a persistent component.

    macro annotation to mark a class as a persistent component. creates a companion object for the class that extends PType. if the class already has a companion object, then adds a parent class PType to the existing companion object.

    Note that, when using this annotation, an existing companion object cannot already extend a class other than PType or scala.AnyRef.

    M

    the model

    Annotations
    @compileTimeOnly( ... )
  9. macro class polyComponent[M] extends Annotation with StaticAnnotation

    macro annotation to mark a trait as a polymorphic persistent component.

    macro annotation to mark a trait as a polymorphic persistent component. creates a companion object for the trait that extends PolyCType. if the trait already has a companion object, then adds a parent class PolyCType to the existing companion object. Note that this will not work if your companion object already extends an abstract or concrete class, as PolyCType itself is an abstract class.

    M

    the model

    Annotations
    @compileTimeOnly( ... )
  10. macro class polyPersistent[M] extends Annotation with StaticAnnotation

    macro annotation to mark a trait as a polymorphic persistent component.

    macro annotation to mark a trait as a polymorphic persistent component. creates a companion object for the class that extends PolyPType. if the class already has a companion object, then adds a parent class PolyPType to the existing companion object.

    Note that, when using this annotation, an existing companion object cannot already extend a class other than PolyPType or scala.AnyRef.

    M

    the model

    Annotations
    @compileTimeOnly( ... )

Value Members

  1. macro def packscanToList[A]: List[A]

    gathers all the As in the same package as the macro was called into a list.

    gathers all the As in the same package as the macro was called into a list.

    this def macro is used by the @domainModel annotation macro to gather all the PTypes and CTypes together to construct the ModelType. it is a little out of place in a package named longevity.model.annotations, but it does not seem appropriate to create a new project or package to contain a single def macro.

    See also

    domainModel

    longevity,model.PType

    longevity,model.CType

    longevity,model.ModelType

Inherited from AnyRef

Inherited from Any

Ungrouped