Remove NormalizedNodePruner.findSchemaNodeForNodePath()
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / transformer / NormalizedNodePruner.java
index cacef95d03506243e322bcb7486ad9617fdbf90e..64dbc1841557897df64a77c3029c74de83767f14 100644 (file)
@@ -49,7 +49,7 @@ public class NormalizedNodePruner implements NormalizedNodeStreamWriter {
     private boolean sealed = false;
 
     public NormalizedNodePruner(final YangInstanceIdentifier nodePath, final SchemaContext schemaContext) {
-        nodePathSchemaNode = findSchemaNodeForNodePath(nodePath, schemaContext);
+        nodePathSchemaNode = DataSchemaContextTree.from(schemaContext).findChild(nodePath).orElse(null);
     }
 
     @SuppressWarnings("unchecked")
@@ -255,17 +255,4 @@ public class NormalizedNodePruner implements NormalizedNodeStreamWriter {
         stack.push(wrapper);
         return wrapper;
     }
-
-    private static DataSchemaContextNode<?> findSchemaNodeForNodePath(final YangInstanceIdentifier nodePath,
-            final SchemaContext schemaContext) {
-        DataSchemaContextNode<?> schemaNode = DataSchemaContextTree.from(schemaContext).getRoot();
-        for (PathArgument arg : nodePath.getPathArguments()) {
-            schemaNode = schemaNode.getChild(arg);
-            if (schemaNode == null) {
-                break;
-            }
-        }
-
-        return schemaNode;
-    }
 }