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