Package io.confound.config
Class SuperConfiguration
- java.lang.Object
-
- io.confound.config.AbstractConfiguration
-
- io.confound.config.AbstractConfigurationDecorator
-
- io.confound.config.SuperConfiguration
-
- All Implemented Interfaces:
Configuration
public class SuperConfiguration extends AbstractConfigurationDecorator
A configuration that decorates another configuration, providing a view of a parent tree of the keyspace. The superconfiguration acts as a live view, but all keys will effectively have the given prefix plus 46 added. For example if a key prefix offoo.bar
is specified, and the decorated configuration has a keyexample
, in the superconfiguration it will only be accessible using the keyfoo.bar.example
.- Author:
- Garret Wilson
-
-
Field Summary
-
Fields inherited from interface io.confound.config.Configuration
KEY_SEGMENT_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description SuperConfiguration(Configuration configuration, java.lang.String prefixKey)
Wrapped configuration constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Optional<java.lang.String>
decorateKey(java.lang.String key)
Transforms the key appropriately before it is passed to the decorated configuration.-
Methods inherited from class io.confound.config.AbstractConfigurationDecorator
findBoolean, findDouble, findInt, findLong, findObject, findObject, findPath, findString, findUri, getBoolean, getConfiguration, 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
-
SuperConfiguration
public SuperConfiguration(@Nonnull Configuration configuration, @Nonnull java.lang.String prefixKey)
Wrapped configuration constructor.- Parameters:
configuration
- The configuration to decorate.prefixKey
- The prefix not including the final segment separator 46.- Throws:
java.lang.NullPointerException
- if the given configuration and/or prefix key isnull
.
-
-
Method Detail
-
decorateKey
protected java.util.Optional<java.lang.String> decorateKey(java.lang.String key)
Description copied from class:AbstractConfigurationDecorator
Transforms the key appropriately before it is passed to the decorated configuration. The key may be given some prefix or have some prefix removed, for example, or the case of the key may be changed.If no key is returned, it indicates that the given key does not represent a key in this configuration view. For example, if the decorator represents a subset of the decorator configuration only for those keys starting with
foo.
, this method would return an empty configuration if a key did not being withfoo.
.- Overrides:
decorateKey
in classAbstractConfigurationDecorator
- Parameters:
key
- The key as provided by the caller.- Returns:
- The key transformed appropriately to be passed to the wrapped configuration.
-
-