object ValueReader
- Companion:
- class
Value members
Concrete methods
Returns the implicit ValueReader[A] in scope.
ValueReader[A]
is equivalent to implicitly[ValueReader[A]]
Returns the implicit ValueReader[A] in scope.
ValueReader[A]
is equivalent to implicitly[ValueReader[A]]
ValueReader that receives a Config whose root is the path being read.
ValueReader that receives a Config whose root is the path being read.
This is generally the most concise way to implement a ValueReader that doesn't depend on the path of the value being read.
For example to read a case class FooBar(foo: Foo, bar: Bar)
, instead of
new ValueReader[FooBar] {
def read(config: Config, path: String): FooBar = {
val localizedConfig = config.getConfig(path)
FooBar(
foo = localizedConfig.as[Foo]("foo"),
bar = localizedConfig.as[Bar]("bar"))
}
}
you could do
ValueReader.relative[FooBar] { config =>
FooBar(
foo = config.as[Foo]("foo"),
bar = config.as[Bar]("bar))
}