Merge "Bug 2117: Inner grouping used in outer grouping's choice case"
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / AlwaysFailOperation.java
1 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
2
3
4 import com.google.common.base.Optional;
5 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
6 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
7 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
8 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
9
10 /**
11  * An implementation of apply operation which fails to do anything,
12  * consistently. An instance of this class is used by the data tree
13  * if it does not have a SchemaContext attached and hence cannot
14  * perform anything meaningful.
15  */
16 final class AlwaysFailOperation implements ModificationApplyOperation {
17     public static final ModificationApplyOperation INSTANCE = new AlwaysFailOperation();
18
19     private AlwaysFailOperation() {
20
21     }
22
23     @Override
24     public Optional<TreeNode> apply(final ModifiedNode modification,
25             final Optional<TreeNode> storeMeta, final Version version) {
26         throw new IllegalStateException("Schema Context is not available.");
27     }
28
29     @Override
30     public void checkApplicable(final YangInstanceIdentifier path,final NodeModification modification, final Optional<TreeNode> storeMetadata) {
31         throw new IllegalStateException("Schema Context is not available.");
32     }
33
34     @Override
35     public Optional<ModificationApplyOperation> getChild(final PathArgument child) {
36         throw new IllegalStateException("Schema Context is not available.");
37     }
38
39     @Override
40     public void verifyStructure(final ModifiedNode modification) {
41         throw new IllegalStateException("Schema Context is not available.");
42     }
43 }