Packages

c

ai.mantik.ds.helper.circe

DiscriminatorDependentCodec

abstract class DiscriminatorDependentCodec[T] extends ObjectEncoder[T] with Decoder[T]

Adds a discriminator for encoding multiple algebraic sub types into the same json. Similar to https://circe.github.io/circe/codecs/adt.html but we can choose the discriminator and values by our self, to make JSON spec simpler.

This is for circe JSON, not Play JSON.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DiscriminatorDependentCodec
  2. Decoder
  3. ObjectEncoder
  4. RootEncoder
  5. Encoder
  6. Serializable
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DiscriminatorDependentCodec(discriminator: String = "kind")

Type Members

  1. case class SubType[X <: T](classTag: ClassTag[X], encoder: ObjectEncoder[X], decoder: Decoder[X], kind: String, isDefault: Boolean) extends Product with Serializable
    Attributes
    protected

Abstract Value Members

  1. abstract val subTypes: Seq[SubType[_ <: T]]

Concrete 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 accumulating: AccumulatingDecoder[T]
    Definition Classes
    Decoder
  5. def apply(c: HCursor): Result[T]
    Definition Classes
    DiscriminatorDependentCodec → Decoder
  6. final def apply(a: T): Json
    Definition Classes
    ObjectEncoder → Encoder
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  9. final def contramap[B](f: (B) ⇒ T): Encoder[B]
    Definition Classes
    Encoder
  10. final def contramapObject[B](f: (B) ⇒ T): ObjectEncoder[B]
    Definition Classes
    ObjectEncoder
  11. final def decodeJson(j: Json): Result[T]
    Definition Classes
    Decoder
  12. implicit def decoder: Decoder[T]
  13. final def either[B](decodeB: Decoder[B]): Decoder[Either[T, B]]
    Definition Classes
    Decoder
  14. final def emap[B](f: (T) ⇒ Either[String, B]): Decoder[B]
    Definition Classes
    Decoder
  15. final def emapTry[B](f: (T) ⇒ Try[B]): Decoder[B]
    Definition Classes
    Decoder
  16. def encodeObject(a: T): JsonObject
    Definition Classes
    DiscriminatorDependentCodec → ObjectEncoder
  17. implicit def encoder: ObjectEncoder[T]
  18. final def ensure(errors: (T) ⇒ List[String]): Decoder[T]
    Definition Classes
    Decoder
  19. final def ensure(pred: (T) ⇒ Boolean, message: ⇒ String): Decoder[T]
    Definition Classes
    Decoder
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  22. final def flatMap[B](f: (T) ⇒ Decoder[B]): Decoder[B]
    Definition Classes
    Decoder
  23. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  24. final def handleErrorWith(f: (DecodingFailure) ⇒ Decoder[T]): Decoder[T]
    Definition Classes
    Decoder
  25. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. final def kleisli: Kleisli[Result, HCursor, T]
    Definition Classes
    Decoder
  28. def makeGivenSubType[X <: T](kind: String, isDefault: Boolean = false)(implicit classTag: ClassTag[X], encoder: ObjectEncoder[X], decoder: Decoder[X]): SubType[X]

    Make a sub type with given encoders/decoders.

    Make a sub type with given encoders/decoders.

    Attributes
    protected
  29. def makeSubType[X <: T](kind: String, isDefault: Boolean = false)(implicit classTag: ClassTag[X], encoder: Lazy[DerivedObjectEncoder[X]], decoder: Lazy[DerivedDecoder[X]]): SubType[X]

    Make a sub type with automatically derived encoders/decoders.

    Make a sub type with automatically derived encoders/decoders.

    Attributes
    protected
  30. final def map[B](f: (T) ⇒ B): Decoder[B]
    Definition Classes
    Decoder
  31. final def mapJson(f: (Json) ⇒ Json): Encoder[T]
    Definition Classes
    Encoder
  32. final def mapJsonObject(f: (JsonObject) ⇒ JsonObject): ObjectEncoder[T]
    Definition Classes
    ObjectEncoder
  33. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  34. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  35. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  36. final def or[AA >: T](d: ⇒ Decoder[AA]): Decoder[AA]
    Definition Classes
    Decoder
  37. final def prepare(f: (ACursor) ⇒ ACursor): Decoder[T]
    Definition Classes
    Decoder
  38. final def product[B](fb: Decoder[B]): Decoder[(T, B)]
    Definition Classes
    Decoder
  39. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  40. def toString(): String
    Definition Classes
    AnyRef → Any
  41. def tryDecode(c: ACursor): Result[T]
    Definition Classes
    Decoder
  42. def tryDecodeAccumulating(c: ACursor): Result[T]
    Definition Classes
    Decoder
  43. final def validate(pred: (HCursor) ⇒ Boolean, message: ⇒ String): Decoder[T]
    Definition Classes
    Decoder
  44. final def validate(errors: (HCursor) ⇒ List[String]): Decoder[T]
    Definition Classes
    Decoder
  45. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  47. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def withErrorMessage(message: String): Decoder[T]
    Definition Classes
    Decoder

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from Decoder[T]

Inherited from ObjectEncoder[T]

Inherited from RootEncoder[T]

Inherited from Encoder[T]

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped