Convert the given configuration into an instance of T if possible
Convert the given configuration into an instance of T if possible
The configuration from which load the config
The base namespace to use for the conversion. This should be used as base
for the name of the fields of T. For instance, given a case class Foo(i: Int)
and a configuration conf = Map("foo.i", "1")
, then from(conf, "foo")
will return
Success(Foo(1))
while from(conf, "")
will return Failure
Success of T if the conversion is possible, Failure with the problem if the conversion is not
Converts a type T to a RawConfig using the namespace as base namespace.
Converts a type T to a RawConfig using the namespace as base namespace.
The instance of T to convert
The base namespace. For instance, given case class Foo(i: Int)
, then
to(Foo(2), "base.namespace")
will return Map("base.namespace.i", "2")
The RawConfig obtained from the T instance
Trait for conversion between T and RawConfig where T is a "complex" type. For "simple" types have a look at StringConvert