Added getModifiedChild to DataTreeCandidateNode.
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / tree / DataTreeCandidateNode.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.api.schema.tree;
9
10 import com.google.common.base.Optional;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15
16 /**
17  * A single node within a {@link DataTreeCandidate}. The nodes are organized
18  * in tree hierarchy, reflecting the modification from which this candidate
19  * was created. The node itself exposes the before- and after-image of the
20  * tree restricted to the modified nodes.
21  */
22 public interface DataTreeCandidateNode {
23
24     /**
25      * Get the node identifier.
26      *
27      * @return The node identifier.
28      */
29     @Nonnull PathArgument getIdentifier();
30
31     /**
32      * Get an unmodifiable iterable of modified child nodes.
33      *
34      * @return Unmodifiable iterable of modified child nodes.
35      */
36     @Nonnull Iterable<DataTreeCandidateNode> getChildNodes();
37
38     /**
39      * Returns modified child or null if child was not modified
40      * / does not exists.
41      *
42      * @param identifier Identifier of child node
43      * @return Modified child or null if child was not modified.
44      */
45     @Nullable DataTreeCandidateNode getModifiedChild(PathArgument identifier);
46
47     /**
48      * Return the type of modification this node is undergoing.
49      *
50      * @return Node modification type.
51      */
52     @Nonnull ModificationType getModificationType();
53
54     /**
55      * Return the before-image of data corresponding to the node.
56      *
57      * @return Node data as they were present in the tree before
58      *         the modification was applied.
59      */
60     Optional<NormalizedNode<?, ?>> getDataAfter();
61
62     /**
63      * Return the after-image of data corresponding to the node.
64      *
65      * @return Node data as they will be present in the tree after
66      *         the modification is applied.
67      */
68     Optional<NormalizedNode<?, ?>> getDataBefore();
69 }