Java Map Replace replaceParameters(String query, Map parameters)

Here you can find the source of replaceParameters(String query, Map parameters)

Description

replace Parameters

License

Apache License

Declaration

public static String replaceParameters(String query, Map<String, String> parameters) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Map;

public class Main {
    public static String replaceParameters(String query, Map<String, String> parameters) {
        if (parameters != null) {
            for (String parameter : parameters.keySet()) {
                String value = parameters.get(parameter);
                if (value == null)
                    value = "";
                query = query.replaceAll("(?i)\\$\\{" + parameter + "\\}", value);
            }//from  w w  w  . ja v  a  2s .co  m
        }
        return query;
    }
}

Related

  1. replaceNode(Map map, Map replacement, List pathItems)
  2. replaceNotContainedWithReplaced(String sentStr, Map mapNotContainedReplaced)
  3. replaceOpcodeNames(HashMap replacementValues, final String input)
  4. replaceParameters(final String value, final Map paramMap)
  5. replaceParameters(Map map, Map originals, Map defaults, Map hards)
  6. replaceParameters(String str, Map parameters)
  7. replaceParams(String str, Map map)
  8. replacePlaceholders(String script, Map configurations)
  9. replacePlaceholders(String string, Map values)