Here you can find the source of replace(String orign, Map replaceStringMap)
private static String replace(String orign, Map replaceStringMap)
//package com.java2s; //License from project: Apache License import java.util.Map; public class Main { /**/*from w w w . java2 s . c o m*/ * replace class Name by class full Name * for example change List to java.util.List * if class Name contains . then get the String that before the first "." to be replaced * for example "List.invoke" get "List" string and replace it with java.util.List * if current string is "java.util.List" then get "java" string and try to replace it * so in most case it will be OK. * but if there existed a key with "java" in the classTypes Map, then "java" string also will be replaced. so it's a bug */ private static String replace(String orign, Map replaceStringMap) { int index = orign.indexOf("."); String checkName = orign; if (index != -1) { checkName = orign.substring(0, index); } String result = orign; if (replaceStringMap.get(checkName) != null) { String classFullName = ((String) replaceStringMap.get(checkName)); result = classFullName + (index > 0 ? orign.substring(index) : orign.substring(checkName.length())); } return result; } }