config

fun <T : Any> config(defaultValue: T): ReadOnlyProperty<ConfigAware, T>

Creates a delegated read-only property that can be used in ConfigAware objects. The name of the property is the key that is used during configuration lookup. The value of the property is evaluated only once.

Parameters

defaultValue

the value that the property evaluates to when there is no key with the name of the property in the config. Although T is defined as Any, only String, Int, Boolean and List are supported.


fun <T : Any, U : Any> config(defaultValue: T, transformer: (T) -> U): ReadOnlyProperty<ConfigAware, U>

Creates a delegated read-only property that can be used in ConfigAware objects. The name of the property is the key that is used during configuration lookup. The value of the property is evaluated and transformed only once.

Parameters

defaultValue

the value that the property evaluates to when there is no key with the name of the property in the config. Although T is defined as Any, only String, Int, Boolean and List are supported.

transformer

a function that transforms the value from the configuration (or the default) into its final value. A typical use case for this is a conversion from a String into a Regex.