private Xpp3Dom toXpp3DomTree(String name, Map<String, Object> config) { Xpp3Dom xConfig = new Xpp3Dom(name); for (Entry<String, Object> entry : config.entrySet()) { if (entry.getValue() instanceof String) { Xpp3Dom node = new Xpp3Dom(entry.getKey()); node.setValue(entry.getValue().toString()); xConfig.addChild(node); } else { @SuppressWarnings("unchecked") // Guaranteed by #configurationMap() Map<String, Object> childMap = (Map<String, Object>) entry.getValue(); // Recurse. Xpp3Dom child = toXpp3DomTree(entry.getKey(), childMap); xConfig.addChild(child); } } return xConfig; }
plugin.setConfiguration(toXpp3DomTree("configuration", config));
private Xpp3Dom toXpp3DomTree(String name, Map<String, Object> config) { Xpp3Dom xConfig = new Xpp3Dom(name); for (Entry<String, Object> entry : config.entrySet()) { if (entry.getValue() instanceof String) { Xpp3Dom node = new Xpp3Dom(entry.getKey()); node.setValue(entry.getValue().toString()); xConfig.addChild(node); } else { @SuppressWarnings("unchecked") // Guaranteed by #configurationMap() Map<String, Object> childMap = (Map<String, Object>) entry.getValue(); // Recurse. Xpp3Dom child = toXpp3DomTree(entry.getKey(), childMap); xConfig.addChild(child); } } return xConfig; }
private Xpp3Dom toXpp3DomTree(String name, Map<String, Object> config) { Xpp3Dom xConfig = new Xpp3Dom(name); for (Entry<String, Object> entry : config.entrySet()) { if (entry.getValue() instanceof String) { Xpp3Dom node = new Xpp3Dom(entry.getKey()); node.setValue(entry.getValue().toString()); xConfig.addChild(node); } else { @SuppressWarnings("unchecked") // Guaranteed by #configurationMap() Map<String, Object> childMap = (Map<String, Object>) entry.getValue(); // Recurse. Xpp3Dom child = toXpp3DomTree(entry.getKey(), childMap); xConfig.addChild(child); } } return xConfig; }
plugin.setConfiguration(toXpp3DomTree("configuration", config));
plugin.setConfiguration(toXpp3DomTree("configuration", config));