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
- Alphabetic
- By Inheritance
Inherited
- DiscriminatorDependentCodec
- Decoder
- ObjectEncoder
- RootEncoder
- Encoder
- Serializable
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Instance Constructors
- new DiscriminatorDependentCodec(discriminator: String = "kind")
Type Members
-
case class
SubType[X <: T](classTag: ClassTag[X], encoder: ObjectEncoder[X], decoder: Decoder[X], kind: String, isDefault: Boolean) extends Product with Serializable
- Attributes
- protected
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
accumulating: AccumulatingDecoder[T]
- Definition Classes
- Decoder
-
def
apply(c: HCursor): Result[T]
- Definition Classes
- DiscriminatorDependentCodec → Decoder
-
final
def
apply(a: T): Json
- Definition Classes
- ObjectEncoder → Encoder
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
contramap[B](f: (B) ⇒ T): Encoder[B]
- Definition Classes
- Encoder
-
final
def
contramapObject[B](f: (B) ⇒ T): ObjectEncoder[B]
- Definition Classes
- ObjectEncoder
-
final
def
decodeJson(j: Json): Result[T]
- Definition Classes
- Decoder
- implicit def decoder: Decoder[T]
-
final
def
either[B](decodeB: Decoder[B]): Decoder[Either[T, B]]
- Definition Classes
- Decoder
-
final
def
emap[B](f: (T) ⇒ Either[String, B]): Decoder[B]
- Definition Classes
- Decoder
-
final
def
emapTry[B](f: (T) ⇒ Try[B]): Decoder[B]
- Definition Classes
- Decoder
-
def
encodeObject(a: T): JsonObject
- Definition Classes
- DiscriminatorDependentCodec → ObjectEncoder
- implicit def encoder: ObjectEncoder[T]
-
final
def
ensure(errors: (T) ⇒ List[String]): Decoder[T]
- Definition Classes
- Decoder
-
final
def
ensure(pred: (T) ⇒ Boolean, message: ⇒ String): Decoder[T]
- Definition Classes
- Decoder
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
flatMap[B](f: (T) ⇒ Decoder[B]): Decoder[B]
- Definition Classes
- Decoder
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
handleErrorWith(f: (DecodingFailure) ⇒ Decoder[T]): Decoder[T]
- Definition Classes
- Decoder
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
kleisli: Kleisli[Result, HCursor, T]
- Definition Classes
- Decoder
-
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
-
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
-
final
def
map[B](f: (T) ⇒ B): Decoder[B]
- Definition Classes
- Decoder
-
final
def
mapJson(f: (Json) ⇒ Json): Encoder[T]
- Definition Classes
- Encoder
-
final
def
mapJsonObject(f: (JsonObject) ⇒ JsonObject): ObjectEncoder[T]
- Definition Classes
- ObjectEncoder
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
or[AA >: T](d: ⇒ Decoder[AA]): Decoder[AA]
- Definition Classes
- Decoder
-
final
def
prepare(f: (ACursor) ⇒ ACursor): Decoder[T]
- Definition Classes
- Decoder
-
final
def
product[B](fb: Decoder[B]): Decoder[(T, B)]
- Definition Classes
- Decoder
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
tryDecode(c: ACursor): Result[T]
- Definition Classes
- Decoder
-
def
tryDecodeAccumulating(c: ACursor): Result[T]
- Definition Classes
- Decoder
-
final
def
validate(pred: (HCursor) ⇒ Boolean, message: ⇒ String): Decoder[T]
- Definition Classes
- Decoder
-
final
def
validate(errors: (HCursor) ⇒ List[String]): Decoder[T]
- Definition Classes
- Decoder
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
withErrorMessage(message: String): Decoder[T]
- Definition Classes
- Decoder