Class StringMapConfiguration

  • All Implemented Interfaces:
    Configuration

    public class StringMapConfiguration
    extends AbstractStringConfiguration
    Configuration implementation backed by a Map with string values.
    Author:
    Garret Wilson
    See Also:
    Map, Map.get(Object)
    • Constructor Detail

      • StringMapConfiguration

        public StringMapConfiguration​(@Nonnull
                                      java.util.Map<java.lang.String,​java.lang.String> map)
        Map constructor.
        Parameters:
        map - The map to back this configuration.
        Throws:
        java.lang.NullPointerException - if the given map is null.
    • Method Detail

      • hasConfigurationValueImpl

        protected boolean hasConfigurationValueImpl​(java.lang.String key)
                                             throws ConfigurationException
        Determines whether a configuration value is present in the underlying storage.

        The given configuration key is assumed to already be normalized, and should not be modified.

        This method must not fall back to parent configuration; only local values must be returned.

        Overrides:
        hasConfigurationValueImpl in class BaseConfiguration<java.lang.String>
        Implementation Specification:
        This implementation delegates to Map.containsKey(Object).
        Parameters:
        key - The normalized configuration key.
        Returns:
        true if a value of any type could be retrieved from this configuration using the given key.
        Throws:
        ConfigurationException - if there is a configuration value stored in an invalid format.
      • findConfigurationValueImpl

        protected java.util.Optional<java.lang.String> findConfigurationValueImpl​(java.lang.String key)
                                                                           throws ConfigurationException
        Implementation to retrieves a general configuration value that may not be present from the underlying storage.

        The given configuration key is assumed to already be normalized, and should not be modified.

        This method must not fall back to parent configuration; only local values must be returned.

        Specified by:
        findConfigurationValueImpl in class BaseConfiguration<java.lang.String>
        Implementation Specification:
        This implementation delegates to Map.get(Object).
        Parameters:
        key - The normalized configuration key.
        Returns:
        The optional configuration value associated with the given key.
        Throws:
        ConfigurationException - if there is a configuration value stored in an invalid format.