Beispiel #1
0
  /* package */ void ensureConstraints(List<Child> children) {
    Set<String> nullElements = new HashSet<String>(model.getElementNames());
    for (Child child : children) {
      nullElements.remove(child.name);
    }

    for (String s : nullElements) {
      ConfigModel.Property p = model.getElement(s);
      for (String annotation : p.getAnnotations()) {
        if (annotation.equals(NotNull.class.getName())) {
          if (p instanceof ConfigModel.Node) {
            ConfigModel childModel = ((ConfigModel.Node) p).model;
            Dom child = document.make(getHabitat(), null, this, childModel);
            child.register();

            children.add(new Dom.NodeChild(s, child));

            // recursive call to ensure the children constraints are also respected
            List<Child> grandChildren = new ArrayList<Child>();
            child.ensureConstraints(grandChildren);
            if (!grandChildren.isEmpty()) {
              child.setChildren(grandChildren);
            }

            child.initializationCompleted();
          }
        }
      }
    }
  }
Beispiel #2
0
 public boolean removeListener(ConfigListener listener) {
   return listeners.remove(listener);
 }