Here you can find the source of replaceParameters(String query, Map
public static String replaceParameters(String query, Map<String, String> parameters)
//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; } }