TypeNaming

trait TypeNaming extends Class[_] => String

Naming strategy, to map each class to a discriminator value.

import reactivemongo.api.bson.{ MacroConfiguration, TypeNaming }

val cfg1 = MacroConfiguration(typeNaming = TypeNaming.FullName)

val cfg2 = MacroConfiguration(typeNaming = TypeNaming.FullName)

val cfg3 = MacroConfiguration(
 typeNaming = TypeNaming { (cls: Class[_]) =>
   "_" + cls.getSimpleName
 })
See also:
Companion:
object
trait Class[_] => String
class Object
trait Matchable
class Any
object FullName.type
object SimpleName.type

Value members

Abstract methods

def apply(tpe: Class[_]): String

Returns the name for the given type.

Returns the name for the given type.

import scala.reflect.ClassTag

import reactivemongo.api.bson.TypeNaming

def foo[T](n: TypeNaming)(implicit ct: ClassTag[T]): String =
 n(ct.runtimeClass)

Concrete methods

Composes the naming with the given function f, applied on the first result.

Composes the naming with the given function f, applied on the first result.

import reactivemongo.api.bson.TypeNaming

val tpeNaming: TypeNaming =
 TypeNaming.SimpleName.andThen(_.toLowerCase)

Inherited methods

def andThen[A](g: String => A): Class[_] => A
Inherited from:
Function1
def compose[A](g: A => Class[_]): A => String
Inherited from:
Function1
override def toString(): String
Definition Classes
Function1 -> Any
Inherited from:
Function1