@Test public void testEffectiveConfig() throws IOException { assertEquals("jdbc:mysql: assertEquals("root", config.get("DataBase.password")); assertEquals("root", config.get("DataBase.password", "default")); assertEquals(1000L, (long) config.get(ofLong(), "Server.AsyncClient.clientTimeout")); Path outputPath = folder.newFile("./effective.properties").toPath(); config.saveEffectiveConfigTo(outputPath); assertTrue(Files.exists(outputPath)); }
private EffectiveConfig(String path, Config config, CallsRegistry callsRegistry) { this.config = config; this.path = path; this.callsRegistry = callsRegistry; this.children = new LinkedHashMap<>(); for (Map.Entry<String, Config> entry : config.getChildren().entrySet()) { this.children.put(entry.getKey(), new EffectiveConfig(concatPath(this.path, entry.getKey()), entry.getValue(), this.callsRegistry)); } }
EffectiveConfig implements Config { private EffectiveConfig(String path, Config config, CallsRegistry callsRegistry) { this.config = config; this.path = path; this.callsRegistry = callsRegistry; this.children = new LinkedHashMap<>(); for (Map.Entry<String, Config> entry : config.getChildren().entrySet()) { this.children.put(entry.getKey(), new EffectiveConfig(concatPath(this.path, entry.getKey()), entry.getValue(), this.callsRegistry)); } } }
EffectiveConfig implements Config { private EffectiveConfig(String path, Config config, CallsRegistry callsRegistry) { this.config = config; this.path = path; this.callsRegistry = callsRegistry; this.children = new LinkedHashMap<>(); for (Map.Entry<String, Config> entry : config.getChildren().entrySet()) { this.children.put(entry.getKey(), new EffectiveConfig(concatPath(this.path, entry.getKey()), entry.getValue(), this.callsRegistry)); } } private  EffectiveConfig(String path, Config config, CallsRegistry callsRegistry); }
EffectiveConfig implements Config { private EffectiveConfig(String path, Config config, CallsRegistry callsRegistry) { this.config = config; this.path = path; this.callsRegistry = callsRegistry; this.children = new LinkedHashMap<>(); for (Map.Entry<String, Config> entry : config.getChildren().entrySet()) { this.children.put(entry.getKey(), new EffectiveConfig(concatPath(this.path, entry.getKey()), entry.getValue(), this.callsRegistry)); } } private  EffectiveConfig(String path, Config config, CallsRegistry callsRegistry); static EffectiveConfig wrap(Config config); @Override String getValue(@Nullable String defaultValue); @Override String getValue(); @Override Map<String, Config> getChildren(); @Override Config provideNoKeyChild(String key); @Override int hashCode(); @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") @Override boolean equals(Object obj); @Override String toString(); void saveEffectiveConfigTo(Path outputPath); synchronized String renderEffectiveConfig(); Map<String, String> getEffectiveDefaults(); Map<String, String> getEffectiveCalls(); }
EffectiveConfig implements Config { private EffectiveConfig(String path, Config config, CallsRegistry callsRegistry) { this.config = config; this.path = path; this.callsRegistry = callsRegistry; this.children = new LinkedHashMap<>(); for (Map.Entry<String, Config> entry : config.getChildren().entrySet()) { this.children.put(entry.getKey(), new EffectiveConfig(concatPath(this.path, entry.getKey()), entry.getValue(), this.callsRegistry)); } } private  EffectiveConfig(String path, Config config, CallsRegistry callsRegistry); static EffectiveConfig wrap(Config config); @Override String getValue(@Nullable String defaultValue); @Override String getValue(); @Override Map<String, Config> getChildren(); @Override Config provideNoKeyChild(String key); @Override int hashCode(); @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") @Override boolean equals(Object obj); @Override String toString(); void saveEffectiveConfigTo(Path outputPath); synchronized String renderEffectiveConfig(); Map<String, String> getEffectiveDefaults(); Map<String, String> getEffectiveCalls();  }