Class AbstractHashConfigurationSource<A,B extends AbstractHashConfigurationSource<A,B>>
- Type Parameters:
A
- raw configuration value typeB
- the hash configuration source type
- All Implemented Interfaces:
ConfigurationSource<AbstractHashConfigurationSource.HashConfigurationQuery<A,
,B>, AbstractHashConfigurationSource.HashExecutableConfigurationQuery<A, B>, AbstractHashConfigurationSource.HashListConfigurationQuery<A, B>> DefaultableConfigurationSource<AbstractHashConfigurationSource.HashConfigurationQuery<A,
B>, AbstractHashConfigurationSource.HashExecutableConfigurationQuery<A, B>, AbstractHashConfigurationSource.HashListConfigurationQuery<A, B>, B>
- Direct Known Subclasses:
CommandLineConfigurationSource
,CPropsFileConfigurationSource
,MapConfigurationSource
,PropertiesConfigurationSource
,PropertyFileConfigurationSource
Base implementation for ConfigurationSource
where configuration properties are resolved using a hash code of a ConfigurationKey
corresponding to a AbstractHashConfigurationSource.HashConfigurationQuery
.
This implementation is intended for configuration sources whose data can be loaded in-memory typically as a hash table (eg. command line parameters, property files...).
Implementors must implement the load()
method which is called to load the configuration properties in memory.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
AbstractHashConfigurationSource.HashConfigurationQuery<A,
B extends AbstractHashConfigurationSource<A, B>> The configuration query used by the a configuration source.static class
AbstractHashConfigurationSource.HashConfigurationQueryResult<A,
B extends AbstractHashConfigurationSource<A, B>> The configuration query result returned by a hash configuration source.static class
AbstractHashConfigurationSource.HashExecutableConfigurationQuery<A,
B extends AbstractHashConfigurationSource<A, B>> The executable configuration query used by a hash configuration source.static class
AbstractHashConfigurationSource.HashListConfigurationQuery<A,
B extends AbstractHashConfigurationSource<A, B>> The list configuration query used by a hash configuration source. -
Field Summary
Modifier and TypeFieldDescriptionprotected final DefaultingStrategy
The defaulting strategy.protected B
The initial configuration source (i.e. before setting defaulting strategy).Fields inherited from class io.inverno.mod.configuration.AbstractConfigurationSource
decoder
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractHashConfigurationSource
(B initial, DefaultingStrategy defaultingStrategy) Creates a hash configuration source from the specified initial source and using the specified defaulting strategy.Creates a hash configuration source with the specified decoder and noop defaulting strategy.protected
AbstractHashConfigurationSource
(SplittablePrimitiveDecoder<A> decoder, DefaultingStrategy defaultingStrategy) Creates a hash configuration source with the specified decoder and defaulting strategy. -
Method Summary
Modifier and TypeMethodDescriptionCreates a configuration query to retrieve the specified properties.Creates a list configuration query to list configuration properties defined with the specified property name.protected abstract Mono
<List<ConfigurationProperty>> load()
Loads the configuration properties.unwrap()
Returns the original configuration source.Methods inherited from class io.inverno.mod.configuration.AbstractConfigurationSource
getDecoder, setDecoder
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.inverno.mod.configuration.DefaultableConfigurationSource
withDefaultingStrategy
-
Field Details
-
defaultingStrategy
The defaulting strategy. -
initial
The initial configuration source (i.e. before setting defaulting strategy).
-
-
Constructor Details
-
AbstractHashConfigurationSource
Creates a hash configuration source with the specified decoder and noop defaulting strategy.
- Parameters:
decoder
- a splittable primitive decoder- Throws:
NullPointerException
- if the specified decoder is null
-
AbstractHashConfigurationSource
protected AbstractHashConfigurationSource(SplittablePrimitiveDecoder<A> decoder, DefaultingStrategy defaultingStrategy) Creates a hash configuration source with the specified decoder and defaulting strategy.
- Parameters:
decoder
- a splittable primitive decoderdefaultingStrategy
- a defaulting strategy
-
AbstractHashConfigurationSource
Creates a hash configuration source from the specified initial source and using the specified defaulting strategy.
- Parameters:
initial
- the initial configuration source.defaultingStrategy
- a defaulting strategy
-
-
Method Details
-
unwrap
Description copied from interface:DefaultableConfigurationSource
Returns the original configuration source.
- Specified by:
unwrap
in interfaceDefaultableConfigurationSource<AbstractHashConfigurationSource.HashConfigurationQuery<A,
B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashExecutableConfigurationQuery<A, B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashListConfigurationQuery<A, B extends AbstractHashConfigurationSource<A, B>>, B extends AbstractHashConfigurationSource<A, B>> - Returns:
- a configuration source
-
load
Loads the configuration properties.
- Returns:
- A mono emitting the list of configuration properties
-
get
public AbstractHashConfigurationSource.HashExecutableConfigurationQuery<A,B> get(String... names) throws IllegalArgumentException Description copied from interface:ConfigurationSource
Creates a configuration query to retrieve the specified properties.
- Specified by:
get
in interfaceConfigurationSource<AbstractHashConfigurationSource.HashConfigurationQuery<A,
B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashExecutableConfigurationQuery<A, B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashListConfigurationQuery<A, B extends AbstractHashConfigurationSource<A, B>>> - 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 AbstractHashConfigurationSource.HashListConfigurationQuery<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.
- Specified by:
list
in interfaceConfigurationSource<AbstractHashConfigurationSource.HashConfigurationQuery<A,
B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashExecutableConfigurationQuery<A, B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashListConfigurationQuery<A, B extends AbstractHashConfigurationSource<A, B>>> - Parameters:
name
- a property name- Returns:
- a list configuration query
- Throws:
IllegalArgumentException
- if the name is null or empty
-