2 * Copyright (c) 2015 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.controller.cluster.datastore.persisted;
10 import com.google.common.base.Optional;
11 import com.google.common.base.Preconditions;
12 import java.util.Collection;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
19 * A deserialized {@link DataTreeCandidateNode} which represents a modification in
20 * one of its children.
22 abstract class ModifiedDataTreeCandidateNode extends AbstractDataTreeCandidateNode {
23 private final Collection<DataTreeCandidateNode> children;
25 private ModifiedDataTreeCandidateNode(final ModificationType type, final Collection<DataTreeCandidateNode> children) {
27 this.children = Preconditions.checkNotNull(children);
30 static DataTreeCandidateNode create(final Collection<DataTreeCandidateNode> children) {
31 return new ModifiedDataTreeCandidateNode(ModificationType.SUBTREE_MODIFIED, children) {
33 public PathArgument getIdentifier() {
34 throw new UnsupportedOperationException("Root node does not have an identifier");
39 static DataTreeCandidateNode create(final PathArgument identifier, final ModificationType type, final Collection<DataTreeCandidateNode> children) {
40 return new ModifiedDataTreeCandidateNode(type, children) {
42 public final PathArgument getIdentifier() {
49 public final Optional<NormalizedNode<?, ?>> getDataAfter() {
50 throw new UnsupportedOperationException("After-image not available after serialization");
54 public final Collection<DataTreeCandidateNode> getChildNodes() {