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.Preconditions;
11 import java.util.Collection;
12 import java.util.Optional;
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,
26 final Collection<DataTreeCandidateNode> children) {
28 this.children = Preconditions.checkNotNull(children);
31 static DataTreeCandidateNode create(final ModificationType type, final Collection<DataTreeCandidateNode> children) {
32 return new ModifiedDataTreeCandidateNode(type, children) {
34 public PathArgument getIdentifier() {
35 throw new UnsupportedOperationException("Root node does not have an identifier");
40 static DataTreeCandidateNode create(final PathArgument identifier, final ModificationType type,
41 final Collection<DataTreeCandidateNode> children) {
42 return new ModifiedDataTreeCandidateNode(type, children) {
44 public PathArgument getIdentifier() {
51 public final Optional<NormalizedNode<?, ?>> getDataAfter() {
52 throw new UnsupportedOperationException("After-image not available after serialization");
56 public final Collection<DataTreeCandidateNode> getChildNodes() {