Пример #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();
          }
        }
      }
    }
  }
Пример #2
0
 protected void setter(ConfigModel.Property target, Object value) throws Exception {
   target.set(this, value);
 }
Пример #3
0
 protected Object getter(ConfigModel.Property target, Type t) {
   return target.get(this, t);
 }