KeyReader

reactivemongo.api.bson.KeyReader
See theKeyReader companion trait
object KeyReader

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
KeyReader.type

Members list

Value members

Concrete methods

def apply[T](read: String => T): KeyReader[T]

Creates a KeyReader based on the given read function.

Creates a KeyReader based on the given read function.

Attributes

def collect[T](read: PartialFunction[String, T]): KeyReader[T]

Creates a KeyReader based on the given partial function.

Creates a KeyReader based on the given partial function.

A exceptions.ValueDoesNotMatchException is returned as Failure for any BSON value that is not matched by the read function.

Attributes

def from[T](readTry: String => Try[T]): KeyReader[T]

Creates a KeyReader based on the given readTry function.

Creates a KeyReader based on the given readTry function.

Attributes

def option[T](read: String => Option[T]): KeyReader[T]

Creates a KeyReader based on the given read function.

Creates a KeyReader based on the given read function.

Attributes

Implicits

Implicits

implicit def byteKeyReader: KeyReader[Byte]
implicit def charKeyReader: KeyReader[Char]
implicit def floatKeyReader: KeyReader[Float]
implicit def intKeyReader: KeyReader[Int]
implicit def keyReader[T](implicit conv: String => T): KeyReader[T]

Provides a KeyReader instance of any T type that can be parsed from a String.

Provides a KeyReader instance of any T type that can be parsed from a String.

Attributes

implicit lazy val localeReader: KeyReader[Locale]

Supports reading locales as keys, using language tag as string representation.

Supports reading locales as keys, using language tag as string representation.

import reactivemongo.api.bson.KeyReader

implicitly[KeyReader[java.util.Locale]].readTry("fr-FR")
// => Success(Locale.FRANCE)

Attributes

implicit def longKeyReader: KeyReader[Long]
implicit def shortKeyReader: KeyReader[Short]
implicit lazy val uuidReader: KeyReader[UUID]

Supports reading UUID as keys.

Supports reading UUID as keys.

import reactivemongo.api.bson.KeyReader

implicitly[KeyReader[java.util.UUID]].
 readTry("BDE87A8B-52F6-4345-9BCE-A30F4CB9FCB4")
// => Success(java.util.UUID{"BDE87A8B-52F6-4345-9BCE-A30F4CB9FCB4"})

Attributes