Packages

object Macros

Macros for generating BSONReader and BSONWriter at compile time.

import reactivemongo.api.bson.Macros

case class Person(name: String, surname: String)

implicit val personHandler = Macros.handler[Person]
See also

MacroOptions for specific options

MacroConfiguration for extended configuration

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

Type Members

  1. final class LocalVar[T] extends AnyRef

    Only for internal purposes

  2. final class Placeholder extends AnyRef

    Only for internal purposes

  3. final class WithOptions[Opts <: MacroOptions] extends AnyRef

    Macros for generating BSONReader and BSONWriter at compile time, with given options.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. def configured[Opts <: MacroOptions](implicit config: Aux[Opts]): WithOptions[Opts]

    Returns macros using the current BSON configuration.

    Returns macros using the current BSON configuration.

    Opts

    the compile-time options

    import reactivemongo.api.bson.{
      BSONDocumentReader, MacroConfiguration, Macros
    }
    
    case class Foo(name: String)
    
    // Materializes a `BSONDocumentReader[Foo]`,
    // with the configuration resolved at compile time
    val r1: BSONDocumentReader[Foo] = Macros.configured.reader[Foo]
    
    val r2: BSONDocumentReader[Foo] = Macros.configured(
      MacroConfiguration.simpleTypeName).reader[Foo]
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. macro def handler[A]: BSONDocumentHandler[A]

    Creates a BSONDocumentHandler for type A.

    Creates a BSONDocumentHandler for type A. The default MacroConfiguration is used (see Macros.configured).

    import reactivemongo.api.bson.{ BSONDocumentHandler, Macros }
    
    case class Foo(bar: String, lorem: Int)
    
    val handler: BSONDocumentHandler[Foo] = Macros.handler
    A

    the type of the value represented as BSON

    Annotations
    @SuppressWarnings()
  12. macro def handlerOpts[A, Opts <: Default]: BSONDocumentHandler[A]

    Creates a BSONDocumentHandler for type A.

    Creates a BSONDocumentHandler for type A. The default MacroConfiguration is used (see Macros.configured), with given additional options.

    import reactivemongo.api.bson.{ Macros, MacroOptions }
    
    case class Foo(bar: String, lorem: Int)
    
    val handler = Macros.handlerOpts[Foo, MacroOptions.Default]
    A

    the type of the value represented as BSON

    Opts

    the compile-time options

    Annotations
    @SuppressWarnings()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. macro def reader[A]: BSONDocumentReader[A]

    Creates a BSONDocumentReader for type A.

    Creates a BSONDocumentReader for type A. The default MacroConfiguration is used (see Macros.configured).

    import reactivemongo.api.bson.{ BSONDocumentReader, Macros }
    
    case class Foo(bar: String, lorem: Int)
    
    val reader: BSONDocumentReader[Foo] = Macros.reader
    A

    the type of the value represented as BSON

    Annotations
    @SuppressWarnings()
  19. macro def readerOpts[A, Opts <: Default]: BSONDocumentReader[A]

    Creates a BSONDocumentReader for type A.

    Creates a BSONDocumentReader for type A. The default MacroConfiguration is used (see Macros.configured), with given additional options.

    import reactivemongo.api.bson.{ Macros, MacroOptions }
    
    case class Foo(bar: String, lorem: Int)
    
    val reader = Macros.readerOpts[Foo, MacroOptions.Verbose]
    A

    the type of the value represented as BSON

    Opts

    the compile-time options

    Annotations
    @SuppressWarnings()
  20. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. def using[Opts <: MacroOptions]: WithOptions[Opts]

    Returns an inference context to call the BSON macros, using explicit compile-time options.

    Returns an inference context to call the BSON macros, using explicit compile-time options.

    Opts

    the compile-time options

    import reactivemongo.api.bson.{ BSONDocumentWriter, Macros, MacroOptions }
    
    case class Bar(score: Float)
    
    val w: BSONDocumentWriter[Bar] =
      Macros.using[MacroOptions.Default].writer[Bar]
  23. macro def valueHandler[A <: AnyVal]: BSONHandler[A]

    Creates a BSONHandler for Value Class A.

    Creates a BSONHandler for Value Class A.

    The inner value will be directly write from BSON value.

    import reactivemongo.api.bson.{
      BSONInteger, BSONReader, BSONWriter, Macros
    }
    
    final class FooVal(val v: Int) extends AnyVal // Value Class
    
    val vreader: BSONReader[FooVal] = Macros.valueReader[FooVal]
    val vwriter: BSONWriter[FooVal] = Macros.valueWriter[FooVal]
    
    vreader.readTry(BSONInteger(1)) // Success(FooVal(1))
    
    vwriter.writeTry(new FooVal(1)) // Success(BSONInteger(1))
    Annotations
    @SuppressWarnings()
  24. macro def valueReader[A <: AnyVal]: BSONReader[A]

    Creates a BSONReader for Value Class A.

    Creates a BSONReader for Value Class A.

    The inner value will be directly read from BSON value.

    import reactivemongo.api.bson.{ BSONInteger, BSONReader, Macros }
    
    final class FooVal(val v: Int) extends AnyVal // Value Class
    
    val vreader: BSONReader[FooVal] = Macros.valueReader[FooVal]
    
    vreader.readTry(BSONInteger(1)) // Success(FooVal(1))
    Annotations
    @SuppressWarnings()
  25. macro def valueWriter[A <: AnyVal]: BSONWriter[A]

    Creates a BSONWriter for Value Class A.

    Creates a BSONWriter for Value Class A.

    The inner value will be directly writen from BSON value.

    import reactivemongo.api.bson.{ BSONWriter, Macros }
    
    final class FooVal(val v: Int) extends AnyVal // Value Class
    
    val vwriter: BSONWriter[FooVal] = Macros.valueWriter[FooVal]
    
    vwriter.writeTry(new FooVal(1)) // Success(BSONInteger(1))
    Annotations
    @SuppressWarnings()
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  29. macro def writer[A]: BSONDocumentWriter[A]

    Creates a BSONDocumentWriter for type A.

    Creates a BSONDocumentWriter for type A. The default MacroConfiguration is used (see Macros.configured).

    import reactivemongo.api.bson.{ BSONDocumentWriter, Macros }
    
    case class Foo(bar: String, lorem: Int)
    
    val writer: BSONDocumentWriter[Foo] = Macros.writer
    A

    the type of the value represented as BSON

    Annotations
    @SuppressWarnings()
  30. macro def writerOpts[A, Opts <: Default]: BSONDocumentWriter[A]

    Creates a BSONDocumentWriter for type A.

    Creates a BSONDocumentWriter for type A. The default MacroConfiguration is used (see Macros.configured), with given additional options.

    import reactivemongo.api.bson.{ Macros, MacroOptions }
    
    case class Foo(bar: String, lorem: Int)
    
    val writer = Macros.writerOpts[Foo, MacroOptions.DisableWarnings]
    A

    the type of the value represented as BSON

    Opts

    the compile-time options

    Annotations
    @SuppressWarnings()
  31. object Annotations

    Annotations to use on case classes that are being processed by macros.

  32. object Placeholder

    Only for internal purposes

Inherited from AnyRef

Inherited from Any

Ungrouped