@Test public void testParseValue() throws IOException { Properties props = new Properties(); props.setProperty("db.vendor", "mysql"); props.setProperty("mysql.driver", "foo"); props.setProperty("oracle.driver", "bar"); props.setProperty("jdbc.driver", "${${db.vendor}.driver}"); Param param = new Param(); param.setSystem(true); param.setName("barbaz"); param.setValue("${bar} plus ${baz} = ${jdbc.driver}"); JAXBConfigImpl config = new JAXBConfigImpl(props); config.setSystemOverride(true); config.doSystem(param); config.resolveRawToCache(); String barbaz1 = config.getProperty("barbaz"); String barbaz2 = config.getRawProperties().getProperty("barbaz"); String barbaz3 = System.getProperty("barbaz"); List<String> barbazes = ImmutableList.of(barbaz1, barbaz2, barbaz3); logger.info("{}", barbazes); }
protected String parseValue(String value, Set<String> keySet) { String result = value; Matcher matcher = pattern.matcher(value); while (matcher.find()) { String key = matcher.group(1); String resolved = resolve(key, keySet); result = matcher.replaceFirst(Matcher.quoteReplacement(resolved)); matcher = matcher.reset(result); } return result; }
JAXBConfigImpl extends AbstractBaseConfig { protected String parseValue(String value, Set<String> keySet) { String result = value; Matcher matcher = pattern.matcher(value); while (matcher.find()) { String key = matcher.group(1); String resolved = resolve(key, keySet); result = matcher.replaceFirst(Matcher.quoteReplacement(resolved)); matcher = matcher.reset(result); } return result; } }
JAXBConfigImpl extends AbstractBaseConfig { protected String parseValue(String value, Set<String> keySet) { String result = value; Matcher matcher = pattern.matcher(value); while (matcher.find()) { String key = matcher.group(1); String resolved = resolve(key, keySet); result = matcher.replaceFirst(Matcher.quoteReplacement(resolved)); matcher = matcher.reset(result); } return result; } JAXBConfigImpl();  JAXBConfigImpl(Config config);  JAXBConfigImpl(String fileLoc, Config config);  JAXBConfigImpl(List<String> fileLocs, Config config);  JAXBConfigImpl(String fileLoc);  JAXBConfigImpl(List<String> fileLocs);  JAXBConfigImpl(Properties properties);  JAXBConfigImpl(String fileLoc, Properties properties);  JAXBConfigImpl(List<String> fileLocs, Properties properties); }
JAXBConfigImpl extends AbstractBaseConfig { protected String parseValue(String value, Set<String> keySet) { String result = value; Matcher matcher = pattern.matcher(value); while (matcher.find()) { String key = matcher.group(1); String resolved = resolve(key, keySet); result = matcher.replaceFirst(Matcher.quoteReplacement(resolved)); matcher = matcher.reset(result); } return result; } JAXBConfigImpl();  JAXBConfigImpl(Config config);  JAXBConfigImpl(String fileLoc, Config config);  JAXBConfigImpl(List<String> fileLocs, Config config);  JAXBConfigImpl(String fileLoc);  JAXBConfigImpl(List<String> fileLocs);  JAXBConfigImpl(Properties properties);  JAXBConfigImpl(String fileLoc, Properties properties);  JAXBConfigImpl(List<String> fileLocs, Properties properties); @Override Object getObject(String key); @Override Map<String, Object> getObjects(); @Override Properties getProperties(); @Override String getProperty(String key); Properties getRawProperties(); @Override void putProperty(String key, String value); @Override void putProperties(Properties properties); @Override void parseConfig(); boolean isSystemOverride(); void setSystemOverride(boolean systemOverride); @Override void putObject(String key, Object value); @Override void putObjects(Map<String, Object> objects); @Override void removeObject(String key); @Override void removeProperty(String key); @Override void putConfig(Config config); @Override String toString(); }
JAXBConfigImpl extends AbstractBaseConfig { protected String parseValue(String value, Set<String> keySet) { String result = value; Matcher matcher = pattern.matcher(value); while (matcher.find()) { String key = matcher.group(1); String resolved = resolve(key, keySet); result = matcher.replaceFirst(Matcher.quoteReplacement(resolved)); matcher = matcher.reset(result); } return result; } JAXBConfigImpl();  JAXBConfigImpl(Config config);  JAXBConfigImpl(String fileLoc, Config config);  JAXBConfigImpl(List<String> fileLocs, Config config);  JAXBConfigImpl(String fileLoc);  JAXBConfigImpl(List<String> fileLocs);  JAXBConfigImpl(Properties properties);  JAXBConfigImpl(String fileLoc, Properties properties);  JAXBConfigImpl(List<String> fileLocs, Properties properties); @Override Object getObject(String key); @Override Map<String, Object> getObjects(); @Override Properties getProperties(); @Override String getProperty(String key); Properties getRawProperties(); @Override void putProperty(String key, String value); @Override void putProperties(Properties properties); @Override void parseConfig(); boolean isSystemOverride(); void setSystemOverride(boolean systemOverride); @Override void putObject(String key, Object value); @Override void putObjects(Map<String, Object> objects); @Override void removeObject(String key); @Override void removeProperty(String key); @Override void putConfig(Config config); @Override String toString();  }