Class MapVariableInterpolator

    • Constructor Detail

      • MapVariableInterpolator

        public MapVariableInterpolator​(String string,
                                       Map<?,​?> variables)
        Constructor.
        Parameters:
        string - a String to interpolate into
        variables - the variables to substitute
      • MapVariableInterpolator

        public MapVariableInterpolator​(String string,
                                       Map<?,​?> variables,
                                       boolean exceptionOnNullVarValue)
        Constructor.
        Parameters:
        string - a String to interpolate into
        variables - the variables to substitute
        exceptionOnNullVarValue - if true an IllegalStateException will be thrown if getValue(String) returns null, otherwise the ${varname} string will be left in the String so that multiple interpolators can be chained
    • Method Detail

      • setVariables

        public final void setVariables​(Map<?,​?> variables)
        Sets the Map of variables.
        Parameters:
        variables - the Map of variables
      • getValue

        protected String getValue​(String variableName)
        Retrieves a value for a variable name during interpolation.
        Specified by:
        getValue in class VariableInterpolator
        Parameters:
        variableName - the variable name
        Returns:
        the value
      • interpolate

        public static String interpolate​(String string,
                                         Map<?,​?> variables)
        Interpolates a String with the arguments defined in the given Map.
        Parameters:
        string - a String to interpolate into
        variables - the variables to substitute
        Returns:
        the interpolated String