MacroOptions factories & utilities.
Attributes
- Companion:
- trait
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- MacroOptions.type
Members list
Type members
Classlikes
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}
Attributes
- Graph
- Supertypes
The default options that are implied if invoking "non-Opts" method. All other options extend this.
The default options that are implied if invoking "non-Opts" method. All other options extend this.
Attributes
- Graph
- Supertypes
- Known subtypes
- trait AutomaticMaterializationtrait DisableWarningstrait ReadDefaultValuestrait UnionType[Types]trait Verbose
The options to disable compilation warnings.
The options to disable compilation warnings.
import reactivemongo.api.bson.{ BSONDocumentWriter, Macros, MacroOptions }
case class Bar(score: Float)
val w: BSONDocumentWriter[Bar] =
Macros.using[MacroOptions.DisableWarnings].writer[Bar]
Attributes
- Graph
- Supertypes
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")
Attributes
- Graph
- Supertypes
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]
}
Attributes
- Types
to restrict the subtypes to handle
- See also:
/
- Graph
- Supertypes
Implicit resolution of MacroOptions
Implicit resolution of MacroOptions
Attributes
- Companion:
- object
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object optionsDefault.type
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]
Attributes
- Graph
- Supertypes
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.
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
Attributes
- See also:
UnionType
- Graph
- Supertypes
- class Objecttrait Matchableclass Any