Package io.confound.config
Class BaseChildConfigurationDecorator<C extends Configuration>
- java.lang.Object
-
- io.confound.config.AbstractConfiguration
-
- io.confound.config.AbstractChildConfigurationDecorator<C>
-
- io.confound.config.BaseChildConfigurationDecorator<C>
-
- Type Parameters:
C
- The type of configuration being decorated.
- All Implemented Interfaces:
Configuration
- Direct Known Subclasses:
ChildConfigurationDecorator
public abstract class BaseChildConfigurationDecorator<C extends Configuration> extends AbstractChildConfigurationDecorator<C>
A base wrapper configuration that forwards calls to the decorated configuration, falling back to a parent configuration.- Author:
- Garret Wilson
-
-
Field Summary
-
Fields inherited from interface io.confound.config.Configuration
KEY_SEGMENT_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description BaseChildConfigurationDecorator(C configuration)
Wrapped configuration constructor.BaseChildConfigurationDecorator(C configuration, C parentConfiguration)
Wrapped configuration and parent configuration constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected C
getConfiguration()
Returns the wrapped configuration.protected java.util.Optional<C>
getParentConfiguration()
-
Methods inherited from class io.confound.config.AbstractChildConfigurationDecorator
findBoolean, findDouble, findInt, findLong, findObject, findObject, findPath, findString, findUri, getBoolean, getDouble, getInt, getLong, getObject, getObject, getPath, getString, getUri, hasConfigurationValue
-
Methods inherited from class io.confound.config.AbstractConfiguration
or
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.confound.config.Configuration
createMissingConfigurationKeyException, requireConfiguration, resolvePath, subConfiguration, superConfiguration, withFallback
-
-
-
-
Constructor Detail
-
BaseChildConfigurationDecorator
public BaseChildConfigurationDecorator(@Nonnull C configuration)
Wrapped configuration constructor.- Parameters:
configuration
- The configuration to decorate.- Throws:
java.lang.NullPointerException
- if the given configuration isnull
.
-
BaseChildConfigurationDecorator
public BaseChildConfigurationDecorator(@Nonnull C configuration, @Nonnull C parentConfiguration)
Wrapped configuration and parent configuration constructor.- Parameters:
configuration
- The configuration to decorate.parentConfiguration
- The parent configuration to use for fallback lookup.- Throws:
java.lang.NullPointerException
- if the given configuration and/or parent configuration isnull
.
-
-
Method Detail
-
getParentConfiguration
protected java.util.Optional<C> getParentConfiguration()
- Specified by:
getParentConfiguration
in classAbstractChildConfigurationDecorator<C extends Configuration>
- Implementation Specification:
- This version will never return
Optional.empty()
. - Returns:
- The parent configuration for fallback lookup.
-
getConfiguration
protected C getConfiguration() throws ConfigurationException
Description copied from class:AbstractChildConfigurationDecorator
Returns the wrapped configuration.- Specified by:
getConfiguration
in classAbstractChildConfigurationDecorator<C extends Configuration>
- Returns:
- The decorated configuration delegate instance.
- Throws:
ConfigurationException
- if there is an error retrieving the configuration.
-
-