Class MapVariableInterpolator

    • Constructor Summary

      Constructors 
      Constructor Description
      MapVariableInterpolator​(java.lang.String string, java.util.Map<?,​?> variables)
      Constructor.
      MapVariableInterpolator​(java.lang.String string, java.util.Map<?,​?> variables, boolean exceptionOnNullVarValue)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String getValue​(java.lang.String variableName)
      Retrieves a value for a variable name during interpolation.
      static java.lang.String interpolate​(java.lang.String string, java.util.Map<?,​?> variables)
      Interpolates a String with the arguments defined in the given Map.
      void setVariables​(java.util.Map<?,​?> variables)
      Sets the Map of variables.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MapVariableInterpolator

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

        public MapVariableInterpolator​(java.lang.String string,
                                       java.util.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​(java.util.Map<?,​?> variables)
        Sets the Map of variables.
        Parameters:
        variables - the Map of variables
      • getValue

        protected java.lang.String getValue​(java.lang.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 java.lang.String interpolate​(java.lang.String string,
                                                   java.util.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