Codecs

uk.gov.hmrc.mongo.play.json.Codecs
See theCodecs companion trait
object Codecs extends Codecs

Attributes

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

Members list

Type members

Inherited classlikes

implicit class BsonOps(bs: BsonValue)

Attributes

Inherited from:
Codecs
Supertypes
class Object
trait Matchable
class Any
implicit class DocumentOps(document: Document)

Attributes

Inherited from:
Codecs
Supertypes
class Object
trait Matchable
class Any
implicit class DocumentsOps(documents: Seq[Document])

Attributes

Inherited from:
Codecs
Supertypes
class Object
trait Matchable
class Any
implicit class JsonOps[A](a: A)(implicit evidence$1: Writes[A])

Attributes

Inherited from:
Codecs
Supertypes
class Object
trait Matchable
class Any
class SumCodecsBuilder[A]

Attributes

Inherited from:
Codecs
Supertypes
class Object
trait Matchable
class Any

Value members

Inherited methods

def fromBson[A : Reads](bs: BsonValue): A

Attributes

Inherited from:
Codecs
def playFormatCodec[A](format: Format[A])(implicit ct: ClassTag[A]): Codec[A]

Attributes

Inherited from:
Codecs
def playFormatCodecsBuilder[A](format: Format[A])(implicit ct: ClassTag[A]): SumCodecsBuilder[A]

This variant of playFormatCodec allows to register a codec for subclasses, which are defined by a play format for a supertype. This is helpful when writing an instance of the subclass to mongo, since codecs are looked up by reflection, and the format will need to be registered explicitly for the subclass.

This variant of playFormatCodec allows to register a codec for subclasses, which are defined by a play format for a supertype. This is helpful when writing an instance of the subclass to mongo, since codecs are looked up by reflection, and the format will need to be registered explicitly for the subclass.

It makes it easier to register for multiple subclasses together.

E.g.

sealed trait Sum
case class Sum1() extends Sum
case class Sum2() extends Sum
val sumFormat: Format[Sum] = ...
 new PlayMongoRepository[Sum](
   domainFormat = sumFormat,
   extraCodecs  = Codecs.playFormatCodecsBuilder(sumFormat).forType[Sum1].forType[Sum2].build
 )

Attributes

Inherited from:
Codecs
inline def playFormatSumCodecs[T : SumOf](format: Format[T]): Seq[Codec[_]]

This variant of playFormatCodec allows to register codecs for all direct subclasses, which are defined by a play format for a supertype. This is helpful when writing an instance of the subclass to mongo, since codecs are looked up by reflection, and the format will need to be registered explicitly for the subclass.

This variant of playFormatCodec allows to register codecs for all direct subclasses, which are defined by a play format for a supertype. This is helpful when writing an instance of the subclass to mongo, since codecs are looked up by reflection, and the format will need to be registered explicitly for the subclass.

E.g.

sealed trait Sum
case class Sum1() extends Sum
case class Sum2() extends Sum
val sumFormat: Format[Sum] = ...
 new PlayMongoRepository[Sum](
   domainFormat = sumFormat,
   extraCodecs  = Codecs.playFormatSumCodecs(sumFormat)
 )

Attributes

Inherited from:
CodecHelper (hidden)
def toBson[A : Writes](a: A): BsonValue

Attributes

Inherited from:
Codecs

Inherited fields

val logger: Logger

Attributes

Inherited from:
Codecs

Implicits

Inherited implicits

final implicit def BsonOps(bs: BsonValue): BsonOps

Attributes

Inherited from:
Codecs
final implicit def DocumentOps(document: Document): DocumentOps

Attributes

Inherited from:
Codecs
final implicit def DocumentsOps(documents: Seq[Document]): DocumentsOps

Attributes

Inherited from:
Codecs
final implicit def JsonOps[A : Writes](a: A): JsonOps[A]

Attributes

Inherited from:
Codecs