/** * Construct from a list of existing objects. * * @param existing * the objects to add to initialize the list with, by calling * justAdd(). */ public ObjectList(final boolean dynamic, final Object... existing) { super(existing.length); this._dynamic=dynamic; for (Object e : existing) { add(e); } }
list.add(childResult);
/** * Construct from a list of existing objects. * * @param existing * the objects to add to initialize the list with, by calling * justAdd(). */ public ObjectList(String name, boolean dynamic, final Object... existing) { super(existing.length); this.name = name; this._dynamic = dynamic; for (Object e : existing) { add(e); } }
list.add(childResult);
/** * {@inheritDoc} */ public ObjectList copy() { ObjectList newList = new ObjectList(name, _dynamic); for (Object item : this) { if (item instanceof IObjectContainer) { item = ((IObjectContainer) item).copy(); } newList.add(item); } return newList; }
/** * {@inheritDoc} */ public ObjectList copy() { ObjectList newList = new ObjectList(_dynamic); for (Object item : this) { if (item instanceof IObjectContainer) { item = ((IObjectContainer) item).copy(); } newList.add(item); } return newList; }
public void addValue(String key, Object value) { ObjectTree tree = new ObjectTree(); tree.put(key, checkToCopy(value)); add(tree); }
@Override public void addValue(String key, Object value) { ObjectTree tree = new ObjectTree(key); tree.put(key, checkToCopy(value)); add(tree); }
@Override public void addValue(String key, Object value) { list.add(value); Object existing = get(key); if (existing == null) { // put will do the copying work, if copy-able put(key, value); // getting a copy of it, if copied Object v = get(key); if (v instanceof ObjectList) { ((ObjectList) v)._dynamic = false; } } else if (existing instanceof ObjectList) { ObjectList existingList = ((ObjectList) existing); if (existingList._dynamic) { ObjectList list = (ObjectList) existing; list.add(value); } else { ObjectList list = new ObjectList(key, true, existing, value); put(key, list); } } else { ObjectList list = new ObjectList(key, true, existing, value); put(key, list); } }
@Override public void addValue(String key, Object value) { Object existing = get(key); if (existing == null) { put(key, value); Object v = get(key); if (v instanceof ObjectList) { ((ObjectList) v)._dynamic = false; } } else if (existing instanceof ObjectList) { ObjectList existingList = ((ObjectList) existing); if (existingList._dynamic) { ObjectList list = (ObjectList) existing; list.add(value); } else { ObjectList list = new ObjectList(true, existing, value); put(key, list); } } else { ObjectList list = new ObjectList(true, existing, value); put(key, list); } }