Class 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 of foo.bar is specified, and the decorated configuration has a key example, in the superconfiguration it will only be accessible using the key foo.bar.example.
    Author:
    Garret Wilson
    • 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 is null.
    • 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 with foo..

        Overrides:
        decorateKey in class AbstractConfigurationDecorator
        Parameters:
        key - The key as provided by the caller.
        Returns:
        The key transformed appropriately to be passed to the wrapped configuration.