MCPcopy
hub / github.com/OpenTSDB/opentsdb / configToContent

Method configToContent

test/tools/TestConfigArgP.java:414–431  ·  view source on GitHub ↗

Converts the passed config to a readable properties file, applying the passed overrides @param config The config to write @param overrides The overrides to apply @return The rendered content

(final Config config, Map<String, String>...overrides)

Source from the content-addressed store, hash-verified

412 * @return The rendered content
413 */
414 protected String configToContent(final Config config, Map<String, String>...overrides) {
415 Properties p = new Properties();
416 for(Map.Entry<String, String> entry: config.getMap().entrySet()) {
417 String vl = entry.getValue();
418 if(vl==null || vl.trim().isEmpty()) continue;
419 p.put(entry.getKey(), vl);
420 }
421 for(Map<String, String> map: overrides) {
422 p.putAll(map);
423 }
424 StringBuilder b = new StringBuilder();
425 for(String key: p.stringPropertyNames()) {
426 b.append(key).append("=")
427 .append(p.getProperty(key))
428 .append(EOL);
429 }
430 return b.toString();
431 }
432
433
434 static interface QuickieResponder {

Callers 2

Calls 7

getMapMethod · 0.80
isEmptyMethod · 0.80
putMethod · 0.80
getValueMethod · 0.45
getKeyMethod · 0.45
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected