@Test public void testResolvePropertyForMultiplePropertes() { Properties source = new Properties(); source.put("camunda.test.oneKey", "1234"); source.put("camunda.test.anotherKey", "5678"); String result = PropertyHelper.resolveProperty(source, "-${ camunda.test.oneKey }-${ camunda.test.anotherKey}-"); Assert.assertEquals("-1234-5678-", result); }
public static String resolveProperty(Properties props, String original) { Matcher matcher = PROPERTY_TEMPLATE.matcher(original); StringBuilder buffer = new StringBuilder(); boolean found = false; while(matcher.find()) { found = true; String propertyName = matcher.group(2).trim(); buffer.append(matcher.group(1)) .append(props.containsKey(propertyName) ? props.getProperty(propertyName) : "") .append(matcher.group(3)); } return found ? buffer.toString() : original; }
PropertyHelper { public static String resolveProperty(Properties props, String original) { Matcher matcher = PROPERTY_TEMPLATE.matcher(original); StringBuilder buffer = new StringBuilder(); boolean found = false; while(matcher.find()) { found = true; String propertyName = matcher.group(2).trim(); buffer.append(matcher.group(1)) .append(props.containsKey(propertyName) ? props.getProperty(propertyName) : "") .append(matcher.group(3)); } return found ? buffer.toString() : original; } }
PropertyHelper { public static String resolveProperty(Properties props, String original) { Matcher matcher = PROPERTY_TEMPLATE.matcher(original); StringBuilder buffer = new StringBuilder(); boolean found = false; while(matcher.find()) { found = true; String propertyName = matcher.group(2).trim(); buffer.append(matcher.group(1)) .append(props.containsKey(propertyName) ? props.getProperty(propertyName) : "") .append(matcher.group(3)); } return found ? buffer.toString() : original; }  }
PropertyHelper { public static String resolveProperty(Properties props, String original) { Matcher matcher = PROPERTY_TEMPLATE.matcher(original); StringBuilder buffer = new StringBuilder(); boolean found = false; while(matcher.find()) { found = true; String propertyName = matcher.group(2).trim(); buffer.append(matcher.group(1)) .append(props.containsKey(propertyName) ? props.getProperty(propertyName) : "") .append(matcher.group(3)); } return found ? buffer.toString() : original; }  static boolean getBooleanProperty(Map<String, String> properties, String name, boolean defaultValue); static Object convertToClass(String value, Class<?> clazz); static void applyProperty(Object configuration, String key, String stringValue); static void applyProperties(Object configuration, Map<String, String> properties); static String resolveProperty(Properties props, String original); }
PropertyHelper { public static String resolveProperty(Properties props, String original) { Matcher matcher = PROPERTY_TEMPLATE.matcher(original); StringBuilder buffer = new StringBuilder(); boolean found = false; while(matcher.find()) { found = true; String propertyName = matcher.group(2).trim(); buffer.append(matcher.group(1)) .append(props.containsKey(propertyName) ? props.getProperty(propertyName) : "") .append(matcher.group(3)); } return found ? buffer.toString() : original; }  static boolean getBooleanProperty(Map<String, String> properties, String name, boolean defaultValue); static Object convertToClass(String value, Class<?> clazz); static void applyProperty(Object configuration, String key, String stringValue); static void applyProperties(Object configuration, Map<String, String> properties); static String resolveProperty(Properties props, String original);  }