2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
10 import java.util.Optional;
11 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
12 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
16 * An implementation of apply operation which fails to do anything, consistently. An instance of this class is used by
17 * the data tree if it does not have a SchemaContext attached and hence cannot perform anything meaningful.
19 final class AlwaysFailOperation extends NonApplyDelegatedModificationApplyOperation {
20 static final ModificationApplyOperation INSTANCE = new AlwaysFailOperation();
22 private AlwaysFailOperation() {
27 ModificationApplyOperation delegate() {
32 Optional<TreeNode> apply(final ModifiedNode modification, final Optional<TreeNode> currentMeta,
33 final Version version) {
38 void checkApplicable(final ModificationPath path, final NodeModification modification,
39 final Optional<TreeNode> current, final Version version) throws DataValidationFailedException {
43 private static IllegalStateException ise() {
44 return new IllegalStateException("Schema Context is not available.");