Migrate getDataChildByName() users
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / leafref / LeafRefUtils.java
index 6d0d22e3de37e6bb4ff84a5c946cec2f44e7d27c..f17f766ed72615f85814f5bd011af73f94c864ea 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 public final class LeafRefUtils {
     private LeafRefUtils() {
-        throw new UnsupportedOperationException();
+        // Hidden on purpose
     }
 
     /**
@@ -63,7 +63,7 @@ public final class LeafRefUtils {
         DataNodeContainer currenDataNodeContainer = module;
         while (nodePathIterator.hasNext()) {
             final QName qname = nodePathIterator.next();
-            final DataSchemaNode child = currenDataNodeContainer.getDataChildByName(qname);
+            final DataSchemaNode child = currenDataNodeContainer.dataChildByName(qname);
 
             if (child instanceof DataNodeContainer) {
                 if (!(child instanceof CaseSchemaNode)) {
@@ -72,7 +72,7 @@ public final class LeafRefUtils {
                 currenDataNodeContainer = (DataNodeContainer) child;
             } else if (child instanceof ChoiceSchemaNode) {
                 if (nodePathIterator.hasNext()) {
-                    currenDataNodeContainer = ((ChoiceSchemaNode) child).getCases().get(nodePathIterator.next());
+                    currenDataNodeContainer = ((ChoiceSchemaNode) child).findCase(nodePathIterator.next()).orElse(null);
                 } else {
                     break;
                 }