trait
Configuration extends AnyRef
Abstract Value Members
-
abstract
def
allPropertyNames: Set[String]
-
abstract
def
getProperty(property: String): Option[String]
Concrete Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
readIn[T](prefix: String = "", enforceFullCoverage: Boolean = false)(implicit arg0: Manifest[T]): T
-
final
def
readIn[T](prefix: String, default: ⇒ T)(implicit arg0: Manifest[T]): T
-
final
def
readInTouched[T](prefix: String, default: ⇒ T)(implicit arg0: Manifest[T]): (T, Set[String])
-
final
def
readInTouched[T](prefix: String)(implicit arg0: Manifest[T]): (T, Set[String])
-
final
def
readOpt[T](prefix: String = "")(implicit arg0: Manifest[T]): Option[T]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toCommandLineString: String
-
def
toPropertiesString: String
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
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.