SumDecoder

trait SumDecoder[T] extends Decoder[T]
Companion:
object
trait Decoder[T]
trait Serializable
class Object
trait Matchable
class Any

Value members

Inherited methods

def apply(c: HCursor): Result[T]

Decode the given HCursor.

Decode the given HCursor.

Inherited from:
Decoder
final def at(field: String): Decoder[T]

Create a new decoder that attempts to navigate to the specified field before decoding.

Create a new decoder that attempts to navigate to the specified field before decoding.

Inherited from:
Decoder
def decodeAccumulating(c: HCursor): AccumulatingResult[T]
Inherited from:
Decoder
final def decodeJson(j: Json): Result[T]

Decode the given Json value.

Decode the given Json value.

Inherited from:
Decoder
final def either[B](decodeB: Decoder[B]): Decoder[Either[T, B]]

Choose the first succeeding decoder, wrapping the result in a disjunction.

Choose the first succeeding decoder, wrapping the result in a disjunction.

Inherited from:
Decoder
final def emap[B](f: T => Either[String, B]): Decoder[B]

Create a new decoder that performs some operation on the result if this one succeeds.

Create a new decoder that performs some operation on the result if this one succeeds.

Value parameters:
f

a function returning either a value or an error message

Inherited from:
Decoder
final def emapTry[B](f: T => Try[B]): Decoder[B]

Create a new decoder that performs some operation on the result if this one succeeds.

Create a new decoder that performs some operation on the result if this one succeeds.

Value parameters:
f

a function returning either a value or an error message

Inherited from:
Decoder
final def ensure(errors: T => List[String]): Decoder[T]

Build a new instance that fails with one or more errors if the condition does not hold for the result.

Build a new instance that fails with one or more errors if the condition does not hold for the result.

If the result of the function applied to the decoded value is the empty list, the new decoder will succeed with that value.

Inherited from:
Decoder
final def ensure(pred: T => Boolean, message: => String): Decoder[T]

Build a new instance that fails if the condition does not hold for the result.

Build a new instance that fails if the condition does not hold for the result.

Note that in the case of chained calls to this method, only the first failure will be returned.

Inherited from:
Decoder
final def flatMap[B](f: T => Decoder[B]): Decoder[B]

Monadically bind a function over this Decoder.

Monadically bind a function over this Decoder.

Inherited from:
Decoder
final def handleErrorWith(f: DecodingFailure => Decoder[T]): Decoder[T]

Create a new instance that handles any of this instance's errors with the given function.

Create a new instance that handles any of this instance's errors with the given function.

Note that in the case of accumulating decoding, only the first error will be used in recovery.

Inherited from:
Decoder
final def kleisli: Kleisli[Result, HCursor, T]

Convert to a Kleisli arrow.

Convert to a Kleisli arrow.

Inherited from:
Decoder
final def map[B](f: T => B): Decoder[B]

Map a function over this Decoder.

Map a function over this Decoder.

Inherited from:
Decoder
final def or[AA >: T](d: => Decoder[AA]): Decoder[AA]

Choose the first succeeding decoder.

Choose the first succeeding decoder.

Inherited from:
Decoder
final def prepare(f: ACursor => ACursor): Decoder[T]

Create a new decoder that performs some operation on the incoming JSON before decoding.

Create a new decoder that performs some operation on the incoming JSON before decoding.

Inherited from:
Decoder
final def product[B](fb: Decoder[B]): Decoder[(T, B)]

Run two decoders and return their results as a pair.

Run two decoders and return their results as a pair.

Inherited from:
Decoder
def tryDecode(c: ACursor): Result[T]

Decode the given ACursor.

Decode the given ACursor.

Note that if you override the default implementation, you should also be sure to override tryDecodeAccumulating in order for fail-fast and accumulating decoding to be consistent.

Inherited from:
Decoder
def tryDecodeAccumulating(c: ACursor): AccumulatingResult[T]
Inherited from:
Decoder
final def validate(pred: HCursor => Boolean, message: => String): Decoder[T]

Build a new instance that fails if the condition does not hold for the input.

Build a new instance that fails if the condition does not hold for the input.

Inherited from:
Decoder
final def validate(errors: HCursor => List[String]): Decoder[T]

Build a new instance that fails if the condition does not hold for the input.

Build a new instance that fails if the condition does not hold for the input.

Inherited from:
Decoder
final def withErrorMessage(message: String): Decoder[T]

Build a new instance with the specified error message.

Build a new instance with the specified error message.

Inherited from:
Decoder