Use properties from that if not found in this
Reads in an object, but throw an exception if not found.
Read in a T using a prefix, backing off to default, if necessary.
Read in a T using a prefix, backing off to default, if necessary.
Read in a T using a prefix, backing off to default, if necessary. Returns T and the set of properties that were used.
Reads in an object, and return the set of property keys we touched
Read in an object, boxing it if necessary.
Configuration provides a way to read in parameters from an underlying representation, usually a properties file. It automatically parses primitives, strings, and Files, and has the ability to handle more complex types via reflection and byte code munging. For instance, we can read in the following:
case class Foo(bool: Boolean, bar: String, path: File, logLevel: Int = 3)
with the following command:
config.readIn[Foo]("foo")
and properties file:foo.bool = true bar = test foo.path = /home/dlwh/
logLevel will automatically be inferred from its default. Nested classes are also supported. By default, Configuration will search for a property using a layered approach: foo.baz.bar, then baz.bar, then bar, following by a default if it's provided.
Some amount of type inference of type arguments is performed, but it's by no means perfect. If something doesn't work that you'd like to work, ask on the mailing list.
Subclassing is also supported. If you readIn[T]("foo"), and the property foo is the name of a subclass of T (fully qualified), then the subclass will be read instead.