public XmlObject getChild(String name) { return findField(name); }
public XmlObject getChild(String name) { return findField(name); }
public boolean removeField(String name) { XmlObject item = findField(name); return item != null && children.remove(item); }
public boolean removeField(String name) { XmlObject item = findField(name); return item != null && children.remove(item); }
public Object getField(String name) { //TODO: optimize XmlObject item = findField(name); Object result = null; if (item != null) { if (item.hasChildren()) { result = item; } else { result = item.getValue(); } } return result; }
public Object getField(String name) { //TODO: optimize XmlObject item = findField(name); Object result = null; if (item != null) { if (item.hasChildren()) { result = item; } else { result = item.getValue(); } } return result; }
private XmlObject addOrSetField(String n, Object value, boolean set) { XmlObject child = null; if (value instanceof XmlObject) { child = (XmlObject) value; child.name = getQNameFor(n); children.add(child); } else { if (set) { child = findField(n); } if (child == null) { child = new XmlObject(getQNameFor(n), value); children.add(child); } else { child.setValue(value); } } return child; }
private XmlObject addOrSetField(String n, Object value, boolean set) { XmlObject child = null; if (value instanceof XmlObject) { child = (XmlObject) value; child.name = getQNameFor(n); children.add(child); } else { if (set) { child = findField(n); } if (child == null) { child = new XmlObject(getQNameFor(n), value); children.add(child); } else { child.setValue(value); } } return child; }