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 java.util.Collection;
11 import java.util.Optional;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
15 import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
18 * A deserialized {@link DataTreeCandidateNode} which represents a deletion.
20 abstract class DeletedDataTreeCandidateNode extends AbstractDataTreeCandidateNode {
21 private DeletedDataTreeCandidateNode() {
22 super(ModificationType.DELETE);
25 static DataTreeCandidateNode create() {
26 return new DeletedDataTreeCandidateNode() {
28 public PathArgument getIdentifier() {
29 throw new UnsupportedOperationException("Root node does not have an identifier");
34 static DataTreeCandidateNode create(final PathArgument identifier) {
35 return new DeletedDataTreeCandidateNode() {
37 public PathArgument getIdentifier() {
44 public final Optional<NormalizedNode> getDataAfter() {
45 return Optional.empty();
49 public final Collection<DataTreeCandidateNode> getChildNodes() {
50 // We would require the before-image to reconstruct the list of nodes which
52 throw new UnsupportedOperationException("Children not available after serialization");