Class ConfigurationProvider

java.lang.Object
is.galia.config.ConfigurationProvider
All Implemented Interfaces:
Configuration

public final class ConfigurationProvider extends Object implements Configuration
Configuration whose accessors access an ordered list of other configurations, which enables "falling back" from one configuration source to another.
  • Method Details

    • clear

      public void clear()
      Description copied from interface: Configuration
      Clears any key-value pairs from the instance (but not its persistent store, if available).
      Specified by:
      clear in interface Configuration
    • clearProperty

      public void clearProperty(String key)
      Description copied from interface: Configuration
      Removes a single key-value pair from the instance (but not its persistent store, if available).
      Specified by:
      clearProperty in interface Configuration
      Parameters:
      key - Key to remove.
    • getBoolean

      public boolean getBoolean(String key)
      Specified by:
      getBoolean in interface Configuration
    • getBoolean

      public boolean getBoolean(String key, boolean defaultValue)
      Specified by:
      getBoolean in interface Configuration
      Returns:
      Boolean value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a boolean.
    • getDouble

      public double getDouble(String key)
      Specified by:
      getDouble in interface Configuration
    • getDouble

      public double getDouble(String key, double defaultValue)
      Specified by:
      getDouble in interface Configuration
      Returns:
      Double value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a double.
    • getFile

      public Optional<Path> getFile()
      Specified by:
      getFile in interface Configuration
      Returns:
      The file backing the instance, if any.
    • getFloat

      public float getFloat(String key)
      Specified by:
      getFloat in interface Configuration
    • getFloat

      public float getFloat(String key, float defaultValue)
      Specified by:
      getFloat in interface Configuration
      Returns:
      Float value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a float.
    • getInt

      public int getInt(String key)
      Specified by:
      getInt in interface Configuration
    • getInt

      public int getInt(String key, int defaultValue)
      Specified by:
      getInt in interface Configuration
      Returns:
      Int value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to an int.
    • getKeys

      public Iterator<String> getKeys()
      Specified by:
      getKeys in interface Configuration
      Returns:
      All keys contained in the configuration.
    • getLong

      public long getLong(String key)
      Specified by:
      getLong in interface Configuration
    • getLong

      public long getLong(String key, long defaultValue)
      Specified by:
      getLong in interface Configuration
      Returns:
      Long value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a long.
    • getProperty

      public Object getProperty(String key)
      Specified by:
      getProperty in interface Configuration
      Returns:
      Object value corresponding to the given key, or null if not set.
    • getString

      public String getString(String key)
      Specified by:
      getString in interface Configuration
      Returns:
      String value corresponding to the given key, or null if not set.
    • getString

      public String getString(String key, String defaultValue)
      Specified by:
      getString in interface Configuration
      Returns:
      String value corresponding to the given key, or the given default value if the target value is null.
    • getWrappedConfigurations

      public List<Configuration> getWrappedConfigurations()
      Returns:
      Unmodifiable instance.
    • reload

      public void reload()
      Description copied from interface: Configuration
      Reloads the configuration from its persistent store.
      Specified by:
      reload in interface Configuration
    • setProperty

      public void setProperty(String key, Object value)
      Specified by:
      setProperty in interface Configuration