public interface Configuration
PropertySource. Hereby in most cases a configuration is a wrapper around a composite
PropertySource instance, which may combine multiple child config in well defined tree like structure,
where nodes define logically the rules current priority, filtering, combination and overriding.
| Modifier and Type | Method and Description |
|---|---|
default String |
get(String key)
Access a property.
|
default <T> T |
get(String key,
Class<T> type)
Get the property keys as type T.
|
<T> T |
get(String key,
TypeLiteral<T> type)
Get the property keys as type T.
|
default Optional<Boolean> |
getBoolean(String key)
Get the property keys as
Boolean. |
default OptionalDouble |
getDouble(String key)
Get the property keys as
Double. |
default OptionalInt |
getInteger(String key)
Get the property keys as
Integer. |
default OptionalLong |
getLong(String key)
Get the property keys as
Long. |
default Optional<String> |
getOptional(String key)
Access a property.
|
default <T> Optional<T> |
getOptional(String key,
Class<T> type)
Get the property keys as type T.
|
default <T> Optional<T> |
getOptional(String key,
TypeLiteral<T> type)
Get the property keys as type T.
|
Map<String,String> |
getProperties()
Access all current known Configuration properties as a full
Map<String,String>. |
default <T> T |
query(ConfigQuery<T> query)
Query a configuration.
|
default Configuration |
with(ConfigOperator operator)
Extension point for adjusting configuration.
|
default String get(String key)
key - the property's key, not null.null.default <T> T get(String key, Class<T> type)
PropertyConverter to be available that is capable current providing type T
fromMap the given String keys.T - the target type.key - the property's absolute, or relative path, e.g. @code
a/b/c/d.myProperty}.type - The target type required, not null.ConfigException - if the keys could not be converted to the required target type.<T> T get(String key, TypeLiteral<T> type)
PropertyConverter to be available that is capable current providing type T
fromMap the given String keys.T - the target type.key - the property's absolute, or relative path, e.g. @code
a/b/c/d.myProperty}.type - The target type required, not null.ConfigException - if the value could not be converted to the required target type by any of the
registered converters.default Optional<String> getOptional(String key)
key - the property's key, not null.default <T> Optional<T> getOptional(String key, Class<T> type)
PropertyConverter to be available that is capable current providing type T
fromMap the given String keys.T - the target type.key - the property's absolute, or relative path, e.g. @code
a/b/c/d.myProperty}.type - The target type required, not null.ConfigException - if the keys could not be converted to the required target type.default <T> Optional<T> getOptional(String key, TypeLiteral<T> type)
PropertyConverter to be available that is capable current providing type T
fromMap the given String keys.T - the target type.key - the property's absolute, or relative path, e.g. @code
a/b/c/d.myProperty}.type - The target type required, not null.ConfigException - if the keys could not be converted to the required target type.Map<String,String> getProperties()
Map<String,String>.
Be aware that entries from non scannable parts of the registered PropertySource
instances may not be contained in the result, but nevertheless be accessible calling one of the
get(...) methods.PropertySources.default Optional<Boolean> getBoolean(String key)
Boolean.key - the property's absolute, or relative path, e.g. a/b/c/d.myProperty.ConfigException - if the configured value could not be converted to the target type.default OptionalInt getInteger(String key)
Integer.key - the property's absolute, or relative path, e.g. @code
a/b/c/d.myProperty}.ConfigException - if the configured value could not be converted to the target type.default OptionalLong getLong(String key)
Long.key - the property's absolute, or relative path, e.g. @code
a/b/c/d.myProperty}.ConfigException - if the configured value could not be converted to the target type.default OptionalDouble getDouble(String key)
Double.key - the property's absolute, or relative path, e.g. @code
a/b/c/d.myProperty}.ConfigException - if the configured value could not be converted to the target type.default Configuration with(ConfigOperator operator)
operator - A configuration operator, e.g. a filter, or an adjuster
combining configurations.null.default <T> T query(ConfigQuery<T> query)
T - the target query result type.query - the query, never null.Copyright © 2014–2015 Apache Software Foundation. All rights reserved.