ConfigDecoder

sealed abstract class ConfigDecoder[A, B]

Decodes configuration values from a first type to a second type.

Companion:
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def decode(key: Option[ConfigKey], value: A): Either[ConfigError, B]

Attempts to decode the specified value to the second type.

Attempts to decode the specified value to the second type.

The key may be used for improved error messages. The key is present for a single configuration value, and missing for default values and composed values.

See also:

ConfigError.decode for creating decode errors

Concrete methods

final def as[C](implicit decoder: ConfigDecoder[B, C]): ConfigDecoder[A, C]

Returns a new ConfigDecoder which attempts to decode values to the specified type.

Returns a new ConfigDecoder which attempts to decode values to the specified type.

final def collect[C](typeName: String)(f: PartialFunction[B, C])(implicit show: Show[B]): ConfigDecoder[A, C]

Returns a new ConfigDecoder which successfully decodes values for which the specified partial function is defined.

Returns a new ConfigDecoder which successfully decodes values for which the specified partial function is defined.

final def contramap[C](f: C => A): ConfigDecoder[C, B]

Returns a new ConfigDecoder which applies the specified function on the value before decoding.

Returns a new ConfigDecoder which applies the specified function on the value before decoding.

final def flatMap[C](f: B => ConfigDecoder[A, C]): ConfigDecoder[A, C]

Returns a new ConfigDecoder using the specified function whenever the value is successfully decoded.

Returns a new ConfigDecoder using the specified function whenever the value is successfully decoded.

final def map[C](f: B => C): ConfigDecoder[A, C]

Returns a new ConfigDecoder which applies the specified function on successfully decoded values.

Returns a new ConfigDecoder which applies the specified function on successfully decoded values.

final def mapEither[C](f: (Option[ConfigKey], B) => Either[ConfigError, C]): ConfigDecoder[A, C]

Returns a new ConfigDecoder which successfully decodes values for which the specified function returns Right.

Returns a new ConfigDecoder which successfully decodes values for which the specified function returns Right.

final def mapOption[C](typeName: String)(f: B => Option[C])(implicit show: Show[B]): ConfigDecoder[A, C]

Returns a new ConfigDecoder which successfully decodes values for which the specified function returns Some.

Returns a new ConfigDecoder which successfully decodes values for which the specified function returns Some.

final def redacted: ConfigDecoder[A, B]

Returns a new ConfigDecoder which redacts sensitive details from error messages.

Returns a new ConfigDecoder which redacts sensitive details from error messages.