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 static java.util.Objects.requireNonNull;
12 import java.util.Collection;
13 import java.util.Optional;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
17 import org.opendaylight.yangtools.yang.data.tree.api.ModificationType;
20 * A deserialized {@link DataTreeCandidateNode} which represents a modification in
21 * one of its children.
23 abstract class ModifiedDataTreeCandidateNode extends AbstractDataTreeCandidateNode {
24 private final Collection<DataTreeCandidateNode> children;
26 private ModifiedDataTreeCandidateNode(final ModificationType type,
27 final Collection<DataTreeCandidateNode> children) {
29 this.children = requireNonNull(children);
32 static DataTreeCandidateNode create(final ModificationType type, final Collection<DataTreeCandidateNode> children) {
33 return new ModifiedDataTreeCandidateNode(type, children) {
35 public PathArgument getIdentifier() {
36 throw new UnsupportedOperationException("Root node does not have an identifier");
41 static DataTreeCandidateNode create(final PathArgument identifier, final ModificationType type,
42 final Collection<DataTreeCandidateNode> children) {
43 return new ModifiedDataTreeCandidateNode(type, children) {
45 public PathArgument getIdentifier() {
52 public final Optional<NormalizedNode> getDataAfter() {
53 throw new UnsupportedOperationException("After-image not available after serialization");
57 public final Collection<DataTreeCandidateNode> getChildNodes() {