public interface ConfigPropertySet
For external property definitions (for example using a .properties
file), the actual property name is
composed using the property set name returned by getName()
and the given specific name
. For
example, if the property set name is test
and the property name is prop
, the actual
property name will be test.prop
.
ConfigProperty
Modifier and Type | Interface and Description |
---|---|
static interface |
ConfigPropertySet.Builder<C extends ConfigPropertySet>
Builder to create
ConfigPropertySet s bound to property data sources. |
static class |
ConfigPropertySet.ConfigurationException
Exception thrown for configuration errors.
|
Modifier and Type | Method and Description |
---|---|
<T> String |
getConfigPropertyName(ConfigProperty<T> property)
Get the complete name of given configuration property, i.e. the property key prefixed by the
ConfigPropertySet name. |
<T> Optional<T> |
getConfigPropertyValue(ConfigProperty<T> property)
Get the value associated to given
property , if available. |
default <T> T |
getConfigPropertyValue(ConfigProperty<T> property,
T defaultValue)
Returns the value associated to given
property . |
default <T> Optional<T> |
getConfigPropertyValueOrElse(ConfigProperty<T> property,
Supplier<Optional<T>> orElse)
Get the value associated to given
property , if available. |
String |
getName()
Configuration property set name, used as property definition prefix.
|
Map<String,String> |
getSubPropertiesUsingPrefix(String prefix)
Get a key-value
Map of all the properties at sub levels of this property set, starting from given prefix. |
<T> boolean |
hasConfigProperty(ConfigProperty<T> property)
Checks whether this property set contains a not
null value associated to given
property . |
String getName()
<T> String getConfigPropertyName(ConfigProperty<T> property)
ConfigPropertySet
name.T
- Property typeproperty
- The configuration property for which to obtain the complete name (not null)<T> boolean hasConfigProperty(ConfigProperty<T> property)
null
value associated to given
property
.T
- Property typeproperty
- Property to check (not null)true
if this property set contains a not null
value associated to given
property
<T> Optional<T> getConfigPropertyValue(ConfigProperty<T> property)
property
, if available.T
- Property typeproperty
- Configuration property to read (not null)default <T> T getConfigPropertyValue(ConfigProperty<T> property, T defaultValue)
property
.T
- Property typeproperty
- Configuration property to read (not null)defaultValue
- Default value to return if property was not found or has no valuedefaultValue
if not founddefault <T> Optional<T> getConfigPropertyValueOrElse(ConfigProperty<T> property, Supplier<Optional<T>> orElse)
property
, if available. If not available, try to obtain the value
from the provided orElse
supplier.T
- Property typeproperty
- Configuration property to read (not null)orElse
- Fallback value supplier (not null)Map<String,String> getSubPropertiesUsingPrefix(String prefix)
Map
of all the properties at sub levels of this property set, starting from given prefix.prefix
- Prefix to use (not null)Copyright © 2019 The Holon Platform. All rights reserved.