Java Utililty Methods Map Substitute

List of utility methods to do Map Substitute

Description

The list of methods to do Map Substitute are organized into topic(s).

Method

StringsubsituteAttr(Map attrMap, String text)
subsitute Attr
if (attrMap == null) {
    return (text);
if (!text.contains("{")) {
    return (text);
String newString = text;
for (Object key : attrMap.keySet()) {
...
Stringsubstitute(String aString, Map variablesValues, String open, String close)
Substitutes variables in aString.
return substitute(aString, variablesValues, open, close, 0);
Stringsubstitute(String page, String payRef, String name, String emailAddress, String when, String license, Map map)
substitute
String x = page;
for (Map.Entry<String, String> en : map.entrySet()) {
    x = replace(x, en.getKey(), en.getValue());
x = x.replace("$PAYREF$", payRef);
x = x.replace("$NAME$", name);
x = x.replace("$EMAIL$", emailAddress);
x = x.replace("$WHEN$", when);
...
Stringsubstitute(String s, Map map)
Substitutes alls occurences of several patterns in a string.
return substitute(s, map, false);
Stringsubstitute(String s, Map map)
substitute
StringBuilder ret = new StringBuilder(s.length());
int pos = 0;
for (int start, end; (start = s.indexOf(START_FLAG, pos)) != -1
        && (end = s.indexOf(END_FLAG, start)) != -1;) {
    ret.append(s.substring(pos, start)).append(map.get(s.substring(start + START_FLAG.length(), end)));
    pos = end + END_FLAG.length();
ret.append(s.substring(pos, s.length()));
...
Stringsubstitute(String str, Map subs)
substitute
for (Map.Entry<String, String> e : subs.entrySet()) {
    String param = e.getKey();
    if (str.contains(param))
        str = str.replace(param, e.getValue());
return str;
Stringsubstitute(String str, Map subs)
substitute
for (Map.Entry<String, String> e : subs.entrySet()) {
    String param = e.getKey();
    if (str.contains(param))
        str = str.replace(param, e.getValue());
return str;
StringsubstituteExpressionLanguage(String stringToParse, Map variableMap)
substitute an EL for objects.
return substituteExpressionLanguage(stringToParse, variableMap, true, true, true, false);
StringsubstituteForTokens(String input, Map tokenMap, boolean invertMap)
Finds and replaces every key from specified Map in specified String by value from this map in brackets '${...}'.
if (invertMap) {
    tokenMap = invertStringMap(tokenMap);
input = input.replaceAll("\\$", "\\$\\$");
Set<String> keySet = tokenMap.keySet();
boolean somethingDone = false;
int index;
do {
...
StringsubstituteProfileProperty(String key, Map> configs)
Substitutes a placeholder with profile:[property file]/[key], with the target value.
String pid = key.substring("profile:".length(), key.indexOf("/"));
String propertyKey = key.substring(key.indexOf("/") + 1);
Map<String, String> targetProps = configs.get(pid);
if (targetProps != null && targetProps.containsKey(propertyKey)) {
    return targetProps.get(propertyKey);
} else {
    return key;