Class VariableMapResolver


  • public final class VariableMapResolver
    extends Object
    Resolve variables in a map referencing other entries from the same map.
    • Constructor Detail

      • VariableMapResolver

        public VariableMapResolver​(ValueProviderGlobalContext valueProviderGlobalContext)
        Parameters:
        valueProviderGlobalContext - Value provider global context
    • Method Detail

      • resolve

        public Map<String,​Object> resolve​(Map<String,​Object> config)
        Replace variable placeholders in values of a map with syntax ${key} with values from the map itself. The variables can recursively reference each other. All escaped variables are deescaped.
        Parameters:
        config - Config map with values with variable placeholders
        Returns:
        Config map with values with variable placeholders resolved
        Throws:
        IllegalArgumentException - when a variable name could not be resolve.d
      • resolve

        public Map<String,​Object> resolve​(Map<String,​Object> config,
                                                boolean deescapeVariables)
        Replace variable placeholders in values of a map with syntax ${key} with values from the map itself. The variables can recursively reference each other.
        Parameters:
        config - Config map with values with variable placeholders
        deescapeVariables - De-escape variables
        Returns:
        Config map with values with variable placeholders resolved
        Throws:
        IllegalArgumentException - when a variable name could not be resolved.
      • deescape

        public Map<String,​Object> deescape​(Map<String,​Object> config)
        De-escapes all escaped variables in all string values in the given map.
        Parameters:
        config - Config map with values that my contain escaped variable references (starting with \$)
        Returns:
        Map with de-escaped variable references.