Correct mandatory leaf enforcement
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / AbstractNodeContainerModificationStrategy.java
index c7686895fd45773475c8ae6991dfa6754626f98d..4821b404a06e1688faa79071aec5d7ec018aeca4 100644 (file)
@@ -116,17 +116,28 @@ abstract class AbstractNodeContainerModificationStrategy<T extends WithStatus>
                 }
             }
 
-            additionalVerifyValueChildren(writtenValue);
+            optionalVerifyValueChildren(writtenValue);
         }
+        mandatoryVerifyValueChildren(writtenValue);
     }
 
     /**
      * Perform additional verification on written value's child structure, like presence of mandatory children and
-     * exclusion. The default implementation does nothing.
+     * exclusion. The default implementation does nothing and is not invoked for non-CONFIG data trees.
      *
      * @param writtenValue Effective written value
      */
-    void additionalVerifyValueChildren(final NormalizedNode<?, ?> writtenValue) {
+    void optionalVerifyValueChildren(final NormalizedNode<?, ?> writtenValue) {
+        // Defaults to no-op
+    }
+
+    /**
+     * Perform additional verification on written value's child structure, like presence of mandatory children.
+     * The default implementation does nothing.
+     *
+     * @param writtenValue Effective written value
+     */
+    void mandatoryVerifyValueChildren(final NormalizedNode<?, ?> writtenValue) {
         // Defaults to no-op
     }