BUG-4295: instantiate MERGE operations lazily
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / AbstractValueNodeModificationStrategy.java
index bd23a4e46c905739d39a38bfadb81371545736e3..e4b80b2fb5beb1372a447ff7146ab8a843e643bb 100644 (file)
@@ -72,4 +72,25 @@ abstract class AbstractValueNodeModificationStrategy<T extends DataSchemaNode> e
             final Optional<TreeNode> current) throws IncorrectDataStructureException {
         throw new IncorrectDataStructureException(path, "Subtree modification is not allowed.");
     }
-}
\ No newline at end of file
+
+    @Override
+    void mergeIntoModifiedNode(final ModifiedNode node, final NormalizedNode<?, ?> value, final Version version) {
+
+        switch (node.getOperation()) {
+            // Delete performs a data dependency check on existence of the node. Performing a merge
+            // on DELETE means we
+            // are really performing a write.
+            case DELETE:
+            case WRITE:
+                node.write(value);
+                break;
+            default:
+                node.updateValue(LogicalOperation.MERGE, value);
+        }
+    }
+
+    @Override
+    void recursivelyVerifyStructure(NormalizedNode<?, ?> value) {
+        verifyStructure(value, false);
+    }
+}