public static void visitElements(Node node, DomElementVisitor visitor) { if (node instanceof Element) { visitor.visit((Element)node); } List<Element> childElements = DOMUtil.listChildElements(node); for (Element childElement: childElements) { visitElements(childElement, visitor); } }
public static void assertElementQName(Element element, QName expectedQName) { QName actual = DOMUtil.getQName(element); assertEquals("Wrong element name", expectedQName, actual); }
/** * Matches QName with a URI representation. The URL may in fact be just the local * part. */ public static boolean matchWithUri(QName qname, String uri) { return match(qname, uriToQName(uri, true)); }
public static boolean shouldStoreActivationItemInShadow(QName elementName, CachingStategyType cachingStrategy) { // MID-2585 if (cachingStrategy == CachingStategyType.PASSIVE) { return true; } else { return QNameUtil.match(elementName, ActivationType.F_ARCHIVE_TIMESTAMP) || QNameUtil.match(elementName, ActivationType.F_DISABLE_TIMESTAMP) || QNameUtil.match(elementName, ActivationType.F_ENABLE_TIMESTAMP) || QNameUtil.match(elementName, ActivationType.F_DISABLE_REASON); } }
@Override public String toHumanReadableString() { if (value == null && expression != null) { return ("expression("+expression+")"); } return PrettyPrinter.prettyPrint(value); }
@Override public String toString() { return debugDump(dumpables); } };
@Override protected void debugDumpOutput(StringBuilder sb, int indent) { DebugUtil.debugDumpWithLabelLn(sb, "attributesToAdd", attributesToAdd, indent + 1); DebugUtil.debugDumpWithLabelLn(sb, "attributesToUpdate", attributesToUpdate, indent + 1); DebugUtil.debugDumpWithLabelLn(sb, "attributesToRemove", attributesToRemove, indent + 1); } }
public static <T> boolean contains(T element, T[] array) { for (T aElement: array) { if (equals(element, aElement)) { return true; } } return false; }
@Override protected void debugDumpSpecific(StringBuilder sb, int indent) { // cannot debug dump conflicting assignment in detail, as we might go into infinite loop // (the assignment could have evaluated rule that would point to another conflicting assignment, which // could point back to this rule) DebugUtil.debugDumpWithLabelToStringLn(sb, "conflictingAssignment", conflictingAssignment, indent); DebugUtil.debugDumpWithLabelToStringLn(sb, "conflictingPath", conflictingPath, indent); }
/** * Convenience method that helps avoid some compiler warnings. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static Collection<? extends ItemDelta<?,?>> createCollection(ItemDelta<?,?>... deltas) { return (Collection)MiscUtil.createCollection(deltas); }
@Override public String toString() { return dumpable.debugDump(index); } };
@Override public String toString() { return dumpable.shortDump(); } };
/** * Returns all values, regardless of the internal sets. */ @SuppressWarnings("unchecked") public Collection<T> union() { return MiscUtil.union(zeroSet, plusSet, minusSet); }
@Override public Map<String, String> getPotentiallyRelevantNamespaces() { return DOMUtil.getAllVisibleNamespaceDeclarations(element); } @Override
@Override public void visit(Element element) { unfortifyNamespaceDeclarationsSingleElement(element); } };
private void foreachSet(Processor<T> processor, Collection<T> set) { if (set == null) { return; } for (T element: set) { processor.process(element); } }
private void foreachSet(Processor<V> processor, Collection<V> set) { if (set == null) { return; } for (V val: set) { processor.process(val); } }