@Test public void testReplace() { Map<String, String> transforms = new TreeMap<>(); transforms.put("uid", "toUpperCase"); assertEquals("fooUSERbar", FilterUtil.replace("foo%uid%bar", "uid", "user", transforms)); }
public static String replace(String filter, String name, String value, Map<String, String> transforms) { if (transforms != null) { String transform; if ((transform = transforms.get(name)) != null) { value = doTransform(value, transform); } } return filter.replaceAll("(?<!\\\\)%" + name + "(?<!\\\\)%", value); }
FilterUtil { public static String replace(String filter, String name, String value, Map<String, String> transforms) { if (transforms != null) { String transform; if ((transform = transforms.get(name)) != null) { value = doTransform(value, transform); } } return filter.replaceAll("(?<!\\\\)%" + name + "(?<!\\\\)%", value); } }
FilterUtil { public static String replace(String filter, String name, String value, Map<String, String> transforms) { if (transforms != null) { String transform; if ((transform = transforms.get(name)) != null) { value = doTransform(value, transform); } } return filter.replaceAll("(?<!\\\\)%" + name + "(?<!\\\\)%", value); } private  FilterUtil(); }
FilterUtil { public static String replace(String filter, String name, String value, Map<String, String> transforms) { if (transforms != null) { String transform; if ((transform = transforms.get(name)) != null) { value = doTransform(value, transform); } } return filter.replaceAll("(?<!\\\\)%" + name + "(?<!\\\\)%", value); } private  FilterUtil(); static void checkTransforms(Map<String, String> transforms); static String replace(String filter, String name, String value, Map<String, String> transforms); static String expandUserFilter(User user, String filter); static String expandUserFilter(User user, String filter, Map<String, String> transforms); }
FilterUtil { public static String replace(String filter, String name, String value, Map<String, String> transforms) { if (transforms != null) { String transform; if ((transform = transforms.get(name)) != null) { value = doTransform(value, transform); } } return filter.replaceAll("(?<!\\\\)%" + name + "(?<!\\\\)%", value); } private  FilterUtil(); static void checkTransforms(Map<String, String> transforms); static String replace(String filter, String name, String value, Map<String, String> transforms); static String expandUserFilter(User user, String filter); static String expandUserFilter(User user, String filter, Map<String, String> transforms);  }