Example #1
0
  /**
   * Updates leaf-element values.
   *
   * <p>Synchronized so that concurrenct modifications will work correctly.
   */
  public synchronized void setLeafElements(final String name, String... values) {
    List<Child> newChildren = new ArrayList<Child>(children);

    LeafChild[] leaves = new LeafChild[values.length];
    for (int i = 0; i < values.length; i++) leaves[i] = new LeafChild(name, values[i]);

    stitchList(newChildren, name, Arrays.asList(leaves));
    children = newChildren;

    // see attribute(String,String) for the issue with this
    getInjector().injectElement(this, name, get());
  }