ValueReader

Companion:
class
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[A](implicit reader: ValueReader[A]): ValueReader[A]

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]]

def relative[A](f: Config => A): 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))
}

Implicits

Implicits

implicit def generatedReader[A](implicit generated: Generated[ValueReader[A]]): ValueReader[A]