Separate out ModificationApplyOperation.verifyStructure()
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / AlwaysFailOperation.java
index 8463c836e8ac2b079604de2744d0448a774861c9..18dae27279527613666fc1799a52fd0d292faea0 100644 (file)
@@ -8,19 +8,15 @@
 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
 import java.util.Optional;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
 
 /**
- * An implementation of apply operation which fails to do anything,
- * consistently. An instance of this class is used by the data tree
- * if it does not have a SchemaContext attached and hence cannot
- * perform anything meaningful.
+ * An implementation of apply operation which fails to do anything, consistently. An instance of this class is used by
+ * the data tree if it does not have a SchemaContext attached and hence cannot perform anything meaningful.
  */
-final class AlwaysFailOperation extends ModificationApplyOperation {
+final class AlwaysFailOperation extends NonApplyDelegatedModificationApplyOperation {
     static final ModificationApplyOperation INSTANCE = new AlwaysFailOperation();
 
     private AlwaysFailOperation() {
@@ -28,39 +24,23 @@ final class AlwaysFailOperation extends ModificationApplyOperation {
     }
 
     @Override
-    Optional<TreeNode> apply(final ModifiedNode modification,
-            final Optional<TreeNode> storeMeta, final Version version) {
-        throw new IllegalStateException("Schema Context is not available.");
+    ModificationApplyOperation delegate() {
+        throw ise();
     }
 
     @Override
-    void checkApplicable(final YangInstanceIdentifier path, final NodeModification modification,
-            final Optional<TreeNode> storeMetadata, final Version version) {
-        throw new IllegalStateException("Schema Context is not available.");
+    Optional<TreeNode> apply(final ModifiedNode modification, final Optional<TreeNode> currentMeta,
+            final Version version) {
+        throw ise();
     }
 
     @Override
-    public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
-        throw new IllegalStateException("Schema Context is not available.");
+    void checkApplicable(final ModificationPath path, final NodeModification modification,
+            final Optional<TreeNode> current, final Version version) throws DataValidationFailedException {
+        throw ise();
     }
 
-    @Override
-    void verifyStructure(final NormalizedNode<?, ?> modification, final boolean verifyChildren) {
-        throw new IllegalStateException("Schema Context is not available.");
-    }
-
-    @Override
-    ChildTrackingPolicy getChildPolicy() {
-        throw new IllegalStateException("Schema Context is not available.");
-    }
-
-    @Override
-    void mergeIntoModifiedNode(final ModifiedNode node, final NormalizedNode<?, ?> value, final Version version) {
-        throw new IllegalStateException("Schema Context is not available.");
-    }
-
-    @Override
-    void recursivelyVerifyStructure(final NormalizedNode<?, ?> value) {
-        throw new IllegalStateException("Schema Context is not available.");
+    private static IllegalStateException ise() {
+        return new IllegalStateException("Schema Context is not available.");
     }
-}
\ No newline at end of file
+}