Object

reactivemongo.bson.Macros

Options

Related Doc: package Macros

Permalink

object Options

Methods with 'Opts' postfix will take additional options in the form of type parameters that will customize behavior of the macros during compilation.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Options
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. trait AllImplementations extends SaveClassName with Default

    Permalink

    Similar to reactivemongo.bson.Macros.Options.UnionType but finds all implementations of the top trait automatically.

    Similar to reactivemongo.bson.Macros.Options.UnionType but finds all implementations of the top trait automatically. For this to be possible the top trait has to be sealed. If your tree is deeper(class extends trait that extends top trait) all the intermediate traits have to be sealed too!

    Example

    sealed trait TopTrait
    case class OneImplementation(data: String) extends TopTrait
    case class SecondImplementation(data: Int) extends TopTrait
    sealed trait RefinedTrait extends TopTrait
    case class ThirdImplementation(data: Float, name: String) extends RefinedTrait
    case object StaticImplementation extends RefinedTrait
    
    val handler = Macros.handlerOpts[TopTrait, AllImplementations]
  2. trait Default extends AnyRef

    Permalink

    Default options that are implied if invoking "non-Opts" method.

    Default options that are implied if invoking "non-Opts" method. All other options extend this.

  3. trait SaveClassName extends Default

    Permalink

    In write method also store class name(dynamic type) as a string in a property named "className".

  4. trait SaveSimpleName extends SaveClassName with Default

    Permalink

    Same as SaveClassName but using the class’ simple name, io.

    Same as SaveClassName but using the class’ simple name, io. the fully-qualified name.

  5. trait SimpleAllImplementations extends AllImplementations with SaveSimpleName with Default

    Permalink

    Same as AllImplementations but saving the simple name io.

    Same as AllImplementations but saving the simple name io. the fully-qualified name.

  6. trait SimpleUnionType[Types <: \/[_, _]] extends UnionType[Types] with SaveSimpleName with Default

    Permalink

    Same as UnionType but saving the class’ simple name io.

    Same as UnionType but saving the class’ simple name io. the fully-qualified name.

    Types

    to use in pattern matching. Listed in a "type list" \/

  7. trait UnionType[Types <: \/[_, _]] extends SaveClassName with Default

    Permalink

    Use type parameter A as static type but use pattern matching to handle different possible subtypes.

    Use type parameter A as static type but use pattern matching to handle different possible subtypes. This makes it easy to persist algebraic data types(pattern where you have a sealed trait and several implementing case classes). When writing a case class into BSON its dynamic type will be pattern matched, when reading from BSON the pattern matching will be done on the className string. This option extends reactivemongo.bson.Macros.Options.SaveClassName in to ensure class names are always serialized.

    If there are handlers available in implicit scope for any of the types in the union they will be used to handle (de)serialization, otherwise handlers for all types will be generated.

    You can also use case object but you have to refer to their types as to singleton types. e.g. case object MyObject, type would be MyObject.type

    Example

    sealed trait Tree
    case class Node(left: Tree, right: Tree) extends Tree
    case class Leaf(data: String) extends Tree
    
    import Macros.Options._
    implicit val treeHandler = Macros.handlerOpts[Tree, UnionType[Node \/ Leaf]]
    Types

    to use in pattern matching. Listed in a "type list" \/

  8. trait Verbose extends Default

    Permalink

    Print out generated code during compilation.

  9. trait \/[A, B] extends AnyRef

    Permalink

    Type for making type-level lists for UnionType.

    Type for making type-level lists for UnionType. If second parameter is another \/ it will be flattend out into a list and so on. Using infix notation makes much more sense since it then looks like a logical disjunction.

    Foo \/ Bar \/ Baz is interpreted as type Foo or type Bar or type Baz

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  16. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped