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.api.schema.tree;
10 import java.util.Collection;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17 * A single node within a {@link DataTreeCandidate}. The nodes are organized in tree hierarchy, reflecting
18 * the modification from which this candidate was created. The node itself exposes the before- and after-image
19 * of the tree restricted to the modified nodes.
21 public interface DataTreeCandidateNode {
23 * Get the node identifier.
25 * @return The node identifier.
27 @NonNull PathArgument getIdentifier();
30 * Get an unmodifiable collection of modified child nodes. Note that the collection may include
31 * {@link ModificationType#UNMODIFIED} nodes, which the caller is expected to handle as if they were not present.
33 * @return Unmodifiable collection of modified child nodes.
35 @NonNull Collection<DataTreeCandidateNode> getChildNodes();
38 * Returns modified child or empty. Note that this method may return an {@link ModificationType#UNMODIFIED} node
39 * when there is evidence of the node or its parent being involved in modification which has turned out not to
40 * modify the node's contents.
42 * @param childIdentifier Identifier of child node
43 * @return Modified child or empty.
44 * @throws NullPointerException if {@code childIdentifier} is null
46 @NonNull Optional<DataTreeCandidateNode> getModifiedChild(PathArgument childIdentifier);
49 * Return the type of modification this node is undergoing.
51 * @return Node modification type.
53 @NonNull ModificationType getModificationType();
56 * Return the after-image of data corresponding to the node.
58 * @return Node data as they will be present in the tree after
59 * the modification is applied.
61 @NonNull Optional<NormalizedNode<?, ?>> getDataAfter();
64 * Return the before-image of data corresponding to the node.
66 * @return Node data as they were present in the tree before
67 * the modification was applied.
69 @NonNull Optional<NormalizedNode<?, ?>> getDataBefore();