Object/Trait

reactivemongo.api.bson

MacroOptions

Related Docs: trait MacroOptions | package bson

Permalink

object MacroOptions

MacroOptions factories & utilities.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MacroOptions
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait AutomaticMaterialization extends Default

    Permalink

    For a sealed family (all implementations of a sealed trait or defined explicit union types), this option enables the automatic materialization of handlers for the member types.

    For a sealed family (all implementations of a sealed trait or defined explicit union types), this option enables the automatic materialization of handlers for the member types.

    If used, make sure it cannot lead to type recursion issue (reason why it's not disabled by default).

    import reactivemongo.api.bson.{ BSONDocumentReader, Macros, MacroOptions }
    
    sealed trait Family
    case class TypeA(n: Int) extends Family
    case class TypeB(s: String) extends Family
    case class TypeC(f: Float) extends Family
    
    val reader: BSONDocumentReader[Family] =
      Macros.using[MacroOptions.AutomaticMaterialization].reader[Family]
      // Automatically/internally materializes the readers for Type{A,B,C}
  2. trait Default extends MacroOptions

    Permalink

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

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

  3. trait DisableWarnings extends Default

    Permalink

    The options to disable compilation warnings.

  4. trait LowPriorityValueOfImplicits extends AnyRef

    Permalink
  5. trait ReadDefaultValues extends Default

    Permalink

    Considering a class property with a default value, when reading the class from BSON if there is no BSON value corresponding to the property, then the default value is used.

    Considering a class property with a default value, when reading the class from BSON if there is no BSON value corresponding to the property, then the default value is used.

    import reactivemongo.api.bson.{
      BSONDocument, BSONDocumentReader, Macros, MacroOptions
    }
    
    case class Foo(id: Int, title: String = "default")
    
    val reader: BSONDocumentReader[Foo] =
      Macros.using[MacroOptions.ReadDefaultValues].reader[Foo]
    
    reader.readTry(BSONDocument("id" -> 1))
    // => Success: Foo(id = 1, title = "default")
  6. trait UnionType[Types <: \/[_, _]] extends Default

    Permalink

    This allows to restrict the handling of family to only some subtypes (not required to be sealed in this case).

    This allows to restrict the handling of family to only some subtypes (not required to be sealed in this case).

    import reactivemongo.api.bson.{
      BSONDocumentWriter, Macros, MacroOptions
    }, MacroOptions.\/
    
    trait Family
    case class TypeA(n: Int) extends Family
    case class TypeB(s: String) extends Family
    case class TypeC(f: Float) extends Family
    
    val writer: BSONDocumentWriter[Family] = {
      implicit val a = Macros.writer[TypeA]
      implicit val b = Macros.writer[TypeB]
    
      Macros.using[MacroOptions.UnionType[TypeA \/ TypeB]].writer[Family]
    }
    Types

    to restrict the subtypes to handle

    See also

    \/

  7. trait ValueOf[O <: MacroOptions] extends AnyRef

    Permalink
  8. trait Verbose extends Default

    Permalink

    The options to print out generated code during compilation.

    The options to print out generated code during compilation.

    import reactivemongo.api.bson.{ BSONDocumentWriter, Macros, MacroOptions }
    
    case class Bar(score: Float)
    
    val w: BSONDocumentWriter[Bar] =
      Macros.using[MacroOptions.Verbose].writer[Bar]
  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

    Annotations
    @SuppressWarnings()
    See also

    UnionType

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. object ValueOf extends LowPriorityValueOfImplicits

    Permalink
  5. final def asInstanceOf[T0]: T0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped