Class AbstractPropertiesConfigurationSource<A,B extends AbstractPropertiesConfigurationSource<A,B>>
- Type Parameters:
A
- raw configuration value typeB
- the properties configuration source type
- All Implemented Interfaces:
ConfigurationSource<AbstractPropertiesConfigurationSource.PropertyConfigurationQuery<A,
B>, AbstractPropertiesConfigurationSource.PropertyExecutableConfigurationQuery<A, B>, AbstractPropertiesConfigurationSource.PropertyListConfigurationQuery<A, B>>
- Direct Known Subclasses:
SystemEnvironmentConfigurationSource
,SystemPropertiesConfigurationSource
Base implementation for ConfigurationSource
where configuration properties are resolved using a property accessor function to retrieve property values.
This implementation is intended for configuration sources whose properties are uniquely identified by a single key such as system properties, system environment variables or maps in general.
As a result, parameterized query are not supported with this kind of configuration source, regardless of the parameters specified when building a query, only the configuration key name is considered when resolving a value.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
AbstractPropertiesConfigurationSource.PropertyConfigurationQuery<A,
B extends AbstractPropertiesConfigurationSource<A, B>> The configuration query used by a properties configuration source.static class
AbstractPropertiesConfigurationSource.PropertyConfigurationQueryResult<A,
B extends AbstractPropertiesConfigurationSource<A, B>> The configuration query result returned by a properties configuration source.static class
AbstractPropertiesConfigurationSource.PropertyExecutableConfigurationQuery<A,
B extends AbstractPropertiesConfigurationSource<A, B>> The executable configuration query used by a properties configuration source.static class
AbstractPropertiesConfigurationSource.PropertyListConfigurationQuery<A,
B extends AbstractPropertiesConfigurationSource<A, B>> The list configuration query used by a properties configuration source. -
Field Summary
Fields inherited from class io.inverno.mod.configuration.AbstractConfigurationSource
decoder
-
Constructor Summary
ConstructorDescriptionCreates a properties configuration source with the specified decoder and property accessor. -
Method Summary
Modifier and TypeMethodDescriptionCreates a configuration query to retrieve the specified properties.getPropertyValue
(String name) Returns the value of the property identified by the specified name.Creates a list configuration query to list configuration properties defined with the specified property name.Returns the list of property names managed by the source.Methods inherited from class io.inverno.mod.configuration.AbstractConfigurationSource
getDecoder, setDecoder
-
Constructor Details
-
AbstractPropertiesConfigurationSource
Creates a properties configuration source with the specified decoder and property accessor.
- Parameters:
decoder
- a value decoder- Throws:
NullPointerException
- if the specified decoder is null
-
-
Method Details
-
getPropertyValue
Returns the value of the property identified by the specified name.
This methods should rely on an underlying synchronous property accessor.
- Parameters:
name
- the configuration property name- Returns:
- an optional returning the configuration property value, or an empty optional if there's no value defined for the specified key
-
listProperties
Returns the list of property names managed by the source.
- Returns:
- a list of configuration property names
-
get
public AbstractPropertiesConfigurationSource.PropertyExecutableConfigurationQuery<A,B> get(String... names) throws IllegalArgumentException Description copied from interface:ConfigurationSource
Creates a configuration query to retrieve the specified properties.
- Parameters:
names
- an array of property names- Returns:
- an executable configuration query
- Throws:
IllegalArgumentException
- if the array of names is null or empty
-
list
public AbstractPropertiesConfigurationSource.PropertyListConfigurationQuery<A,B> list(String name) throws IllegalArgumentException Description copied from interface:ConfigurationSource
Creates a list configuration query to list configuration properties defined with the specified property name.
- Parameters:
name
- a property name- Returns:
- a list configuration query
- Throws:
IllegalArgumentException
- if the name is null or empty
-