public static void normalizeAllRelations(Item<?, ?> item, RelationRegistry relationRegistry) { if (item != null) { item.accept(createNormalizingVisitor(relationRegistry)); } }
@Override public void accept(Visitor visitor) { super.accept(visitor); if (items != null) { for (Item<?,?> item : new ArrayList<>(items)) { // to allow modifying item list via the acceptor item.accept(visitor); } } }
@Override public void accept(Visitor visitor, ItemPath path, boolean recursive) { if (path == null || path.isEmpty()) { // We are at the end of path, continue with regular visits all the way to the bottom if (recursive) { accept(visitor); } else { visitor.visit(this); } } else { Object first = path.first(); if (!ItemPath.isName(first)) { throw new IllegalArgumentException("Attempt to lookup item using a non-name path "+path+" in "+this); } QName subName = ItemPath.toName(first); ItemPath rest = path.rest(); if (items != null) { for (Item<?,?> item : items) { // todo unqualified names! if (subName.equals(item.getElementName())) { item.accept(visitor, rest, recursive); } } } } }