/** * Flattens this ConfigObject populating the results into the target Map * * @see ConfigObject#flatten() */ public Map flatten(Map target) { if (target == null) target = new ConfigObject(); populate("", target, this); return target; }
/** * Overrides the default getProperty implementation to create nested ConfigObject instances on demand * for non-existent keys */ public Object getProperty(String name) { if ("configFile".equals(name)) return this.configFile; if (!containsKey(name)) { ConfigObject prop = new ConfigObject(this.configFile); put(name, prop); return prop; } return get(name); }
@Root(name="webtv", strict = false) public class XmlModelMapper { public ConfigObject getConfigObject() { return configObject; } @Element(name="config") public ConfigObject configObject = new ConfigObject(); //rest of the elements ... }
/** * Flattens this ConfigObject populating the results into the target Map * * @see ConfigObject#flatten() */ public Map flatten(Map target) { if (target == null) target = new ConfigObject(); populate("", target, this); return target; }
public void properties(Closure<Properties> closure) { ConfigObject config = new ConfigObject(); closure.setResolveStrategy(Closure.DELEGATE_ONLY); closure.setDelegate(config); closure.call(); config.flatten(this.properties); }
/** * Overrides the default getProperty implementation to create nested ConfigObject instances on demand * for non-existent keys */ public Object getProperty(String name) { if ("configFile".equals(name)) return this.configFile; if (!containsKey(name)) { ConfigObject prop = new ConfigObject(this.configFile); put(name, prop); return prop; } return get(name); }
ConfigObject flatConfigObject = new ConfigObject(); configObject.flatten(flatConfigObject); flatConfigObject.merge(configObject);