Class ConfigMap

  • All Implemented Interfaces:
    Map<String,​String>

    public class ConfigMap
    extends AbstractMap<String,​String>
    Extracts config values from an inner map or environment variables in a hierarchical fashion. For example new ConfigMap(map).subMap("foo").get("bar") will either return map.get("foo.bar"), System.getenv("FOO_BAR"), or throw ConfigException.

    The most important operations:

    • get(Object) returns the prefixed variable specified or environment variable with a comparable name or else throws exception
    • getOrDefault(Object, String) returns the prefixed variable specified or environment variable with a comparable name or default value
    • subMap(String) returns a ConfigMap which resolves all variables relative to the prefix
    • entrySet() gets all entries with a key with the current prefix does not include environment variables