package org.opendaylight.yangtools.yang.data.util;
-import java.net.URI;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.Revision;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.common.XMLNamespace;
+import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
public final class ParserStreamUtils {
-
private ParserStreamUtils() {
- throw new UnsupportedOperationException("Utility class should not be instantiated.");
+ // Hidden on purpose
}
/**
* (where n is number of choices through it was passed)
*/
public static Deque<DataSchemaNode> findSchemaNodeByNameAndNamespace(final DataSchemaNode dataSchemaNode,
- final String childName, final URI namespace) {
+ final String childName, final XMLNamespace namespace) {
final Deque<DataSchemaNode> result = new ArrayDeque<>();
final List<ChoiceSchemaNode> childChoices = new ArrayList<>();
DataSchemaNode potentialChildNode = null;
childChoices.add((ChoiceSchemaNode) childNode);
} else {
final QName childQName = childNode.getQName();
-
- if (childQName.getLocalName().equals(childName) && childQName.getNamespace().equals(namespace)) {
- if (potentialChildNode == null || Revision.compare(childQName.getRevision(),
- potentialChildNode.getQName().getRevision()) > 0) {
- potentialChildNode = childNode;
- }
+ if (childQName.getLocalName().equals(childName) && childQName.getNamespace().equals(namespace)
+ && (potentialChildNode == null || Revision.compare(childQName.getRevision(),
+ potentialChildNode.getQName().getRevision()) > 0)) {
+ potentialChildNode = childNode;
}
}
}
// try to find data schema node in choice (looking for first match)
for (final ChoiceSchemaNode choiceNode : childChoices) {
- for (final ChoiceCaseNode concreteCase : choiceNode.getCases().values()) {
+ for (final CaseSchemaNode concreteCase : choiceNode.getCases()) {
final Deque<DataSchemaNode> resultFromRecursion = findSchemaNodeByNameAndNamespace(concreteCase,
childName, namespace);
if (!resultFromRecursion.isEmpty()) {