private ConfigurationElementBuilder(ConfigurationElementBuilder elementBuilder) { configurationElement = new ConfigurationElementImpl(); this.elementBuilder = elementBuilder; }
public ConfigurationElementBuilder addChild(PluginElement element) { configurationElement.addChild(element); return this; }
@Override public Map<String, String> getAttributes() { return configurationElement.getAttributes(); }
public static ConfigurationElementBuilder createFromExisting(ConfigurationElement element) { if (element instanceof ConfigurationElementBuilder) { ConfigurationElementBuilder elementBuilder = (ConfigurationElementBuilder) element; ConfigurationElementBuilder builder = new ConfigurationElementBuilder(elementBuilder); builder.configurationElement.setName(element.getName()); builder.configurationElement.setText(element.getText()); builder.configurationElement.setChildren(element.getChildren()); builder.configurationElement.getMutableAttributes().putAll(element.getAttributes()); return builder; } else if (element instanceof ConfigurationElementImpl) { ConfigurationElementBuilder builder = new ConfigurationElementBuilder(); builder.configurationElement = (ConfigurationElementImpl) element; return builder; } else { throw new IllegalArgumentException("Unsupported type: " + element.getClass()); } }
@Override public ConfigurationElement getChildByName(String name, boolean directChildsOnly) { return getConfigElementRecursiveByContent(this, name, FilterType.NAME, directChildsOnly); }
@Override public ConfigurationElement getChildByName(String name, boolean directChildsOnly) { return configurationElement.getChildByName(name, directChildsOnly); }
@Override public ConfigurationElement getChildByContent(String content) { return configurationElement.getChildByContent(content); }
public ConfigurationElementBuilder addAttribute(String name, String value) { configurationElement.getMutableAttributes().put(name, value); return this; }
@Override public List<PluginElement> getChildren() { return configurationElement.getChildren(); }
@Override public String getName() { return configurationElement.getName(); }
@Override public String getText() { return configurationElement.getText(); }
@Override public ConfigurationElement getChildByContent(String content, boolean directChildsOnly) { return getConfigElementRecursiveByContent(this, content, FilterType.CONTENT, directChildsOnly); }
@Override public ConfigurationElement getChildByName(String name) { return configurationElement.getChildByName(name); }
@Override public ConfigurationElement getChildByContent(String content, boolean directChildsOnly) { return configurationElement.getChildByContent(content, directChildsOnly); }
public ConfigurationElementBuilder removeAttribute(String name) { configurationElement.getMutableAttributes().remove(name); return this; }
@Override public ConfigurationElement getChildByContent(String content) { return getConfigElementRecursiveByContent(this, content, FilterType.CONTENT, false); }
public ConfigurationElementBuilder createConfigurationElement(String name) { ConfigurationElementBuilder builder = ConfigurationElementBuilder.create(this); builder.setName(name); configurationElement.addChild(builder); return builder; }
private ConfigurationElementBuilder() { configurationElement = new ConfigurationElementImpl(); }
@Override public ConfigurationElement getChildByName(String name) { return getConfigElementRecursiveByContent(this, name, FilterType.NAME, false); }
public ConfigurationElementBuilder addChild(String configElement) { ConfigurationElementBuilder builder = ConfigurationElementBuilder.create(this) .setName(configElement); configurationElement.addChild(builder); return builder; }