protected void setChildren(Collection<C> kids) { for (C kid : kids) { addChild(kid); } }
public void addConfiguration(CompoundConfiguration<C> config) { // add config's children to our own setChildren(config.getChildren()); // add config's properties to ours super.addConfiguration(config); }
@Override public void validate() { super.validate(); for (Data datum : data) { datum.validate(); } }
protected void appendChildren(StringBuilder out, String childrenName, String childDelim) { if (hasChildren()) { if (hasProperties()) { out.append(" and "); } else { out.append(" with "); } out.append(children.size()); out.append(' '); out.append(childrenName); for (C child : children) { out.append(child); out.append(childDelim); } } }
protected void addChild(C newKid) { // check if we already have a matching child C child = getChild(newKid); if (child != null) { // compound children can just have the new props and kids // added to the old ones, we don't need to replace the old if (child instanceof CompoundConfiguration) { ((CompoundConfiguration)child) .addConfiguration((CompoundConfiguration)newKid); } else { // add newKid's values to childs (overwriting any dupes) child.addConfiguration(newKid); } } else { // simply adopt the new kid children.add(newKid); } }
public void addConfiguration(FactoryConfiguration config) { // add config's Data to our own setData(config.getData()); // add config's sources to our own for (String source : config.getSources()) { addSource(source); } // pass to CompoundConfiguration's to add properties super.addConfiguration(config); }
@Override public void validate() super.validate();