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 // FIXME: 5.0.0: Use @NonNullByDefault
22 public interface DataTreeCandidateNode {
24 * Get the node identifier.
26 * @return The node identifier.
28 @NonNull PathArgument getIdentifier();
31 * Get an unmodifiable collection of modified child nodes. Note that the collection may include
32 * {@link ModificationType#UNMODIFIED} nodes, which the caller is expected to handle as if they were not present.
34 * @return Unmodifiable collection of modified child nodes.
36 @NonNull Collection<DataTreeCandidateNode> getChildNodes();
39 * Returns modified child or empty. Note that this method may return an {@link ModificationType#UNMODIFIED} node
40 * when there is evidence of the node or its parent being involved in modification which has turned out not to
41 * modify the node's contents.
43 * @param childIdentifier Identifier of child node
44 * @return Modified child or empty.
45 * @throws NullPointerException if {@code childIdentifier} is null
47 @NonNull Optional<DataTreeCandidateNode> getModifiedChild(PathArgument childIdentifier);
50 * Return the type of modification this node is undergoing.
52 * @return Node modification type.
54 @NonNull ModificationType getModificationType();
57 * Return the after-image of data corresponding to the node.
59 * @return Node data as they will be present in the tree after
60 * the modification is applied.
62 @NonNull Optional<NormalizedNode<?, ?>> getDataAfter();
65 * Return the before-image of data corresponding to the node.
67 * @return Node data as they were present in the tree before
68 * the modification was applied.
70 @NonNull Optional<NormalizedNode<?, ?>> getDataBefore();