public <T> T nodeByTypeElement(Class<T> baseType) { int len = children.size(); for (int i = 0; i < len; i++) { Child child = children.get(i); if (child instanceof NodeChild) { NodeChild nc = (NodeChild) child; if (model.elements.containsKey(nc.name)) continue; // match with named if (baseType.isAssignableFrom(nc.dom.getImplementationClass())) return baseType.cast(nc.dom.get()); } } return null; }
/** * Picks up all node elements that are assignable to the given type, except those who are matched * by other named elements in the model. * * <p>Used to implement {@code FromElement("*")}. */ public List<Dom> domNodeByTypeElements(Class baseType) { List<Dom> r = new ArrayList<Dom>(); int len = children.size(); for (int i = 0; i < len; i++) { Child child = children.get(i); if (child instanceof NodeChild) { NodeChild nc = (NodeChild) child; if (model.elements.containsKey(nc.name)) continue; // match with named if (baseType.isAssignableFrom(nc.dom.getImplementationClass())) r.add(nc.dom); } } return r; }