public class Subset implements Configuration
Represents a subset of a larger set of configuration properties.
The namePrefix and a "." separator is prepended to keys looked up in this configuration, and the keys are then looked up in configuration.
For example, if initialised with a namePrefix of "db", a look up with a key named "password" would be delegated to configuration as a look up for "db.password".
Configuration.DefaultImpls| Constructor and Description |
|---|
Subset(java.lang.String namePrefix,
Configuration configuration)
Represents a subset of a larger set of configuration properties.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Key<?> key) |
<T> T |
get(Key<? extends T> key)
Look up a property value identified by key, or throw
class Misconfiguration if there is no definition of the
property. Implementations can override missingPropertyMessage to provide a more detailed error message
for the exception. |
<T> T |
getOrElse(Key<? extends T> key,
T p)
Look up a property value identified by key, or return default with the key if there is no definition of the
property.
|
<T> T |
getOrElse(Key<? extends T> key,
kotlin.jvm.functions.Function1<? super com.natpryce.konfig.Key<?extendsT>,? extends T> p)
Look up a property value identified by key, or call default with the key if there is no definition of the
property.
|
<T> T |
getOrNull(Key<? extends T> key)
Look up a property value identified by key, or return
null if there is no definition of the
property. |
NonExistentClass |
list() |
java.util.List<com.natpryce.konfig.PropertyLocation> |
searchPath(Key<?> key)
Report the locations that will be searched for a configuration property, in priority order. The value used
is taken from the first location in the list that contains a mapping for the key.
|
contains, get, getOrElse, getOrElse, getOrNull, list, searchPathpublic Subset(java.lang.String namePrefix,
Configuration configuration)
Represents a subset of a larger set of configuration properties.
The namePrefix and a "." separator is prepended to keys looked up in this configuration, and the keys are then looked up in configuration.
For example, if initialised with a namePrefix of "db", a look up with a key named "password" would be delegated to configuration as a look up for "db.password".
public <T> T getOrNull(Key<? extends T> key)
Look up a property value identified by key, or return null if there is no definition of the
property.
public boolean contains(Key<?> key)
public java.util.List<com.natpryce.konfig.PropertyLocation> searchPath(Key<?> key)
Report the locations that will be searched for a configuration property, in priority order. The value used is taken from the first location in the list that contains a mapping for the key.
public NonExistentClass list()
public <T> T get(Key<? extends T> key)
Look up a property value identified by key, or throw class Misconfiguration if there is no definition of the
property. Implementations can override missingPropertyMessage to provide a more detailed error message
for the exception.
class Misconfigurationpublic <T> T getOrElse(Key<? extends T> key, T p)
Look up a property value identified by key, or return default with the key if there is no definition of the property.
public <T> T getOrElse(Key<? extends T> key, kotlin.jvm.functions.Function1<? super com.natpryce.konfig.Key<?extendsT>,? extends T> p)
Look up a property value identified by key, or call default with the key if there is no definition of the property.