Cleanup use of Guava library
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / NodeModification.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.impl.schema.tree;
9
10 import java.util.Collection;
11 import java.util.Optional;
12 import org.opendaylight.yangtools.concepts.Identifiable;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
15
16 /**
17  * Internal interface representing a modification action of a particular node.
18  * It is used by the validation code to allow for a read-only view of the
19  * modification tree as we should never modify that during validation.
20  */
21 abstract class NodeModification implements Identifiable<PathArgument> {
22     /**
23      * Get the type of modification.
24      *
25      * @return Operation type.
26      */
27     abstract LogicalOperation getOperation();
28
29     /**
30      * Get the original tree node to which the modification is to be applied.
31      *
32      * @return The original node, or {@link Optional#absent()} if the node is
33      *         a new node.
34      */
35     abstract Optional<TreeNode> getOriginal();
36
37     /**
38      * Get a read-only view of children nodes.
39      *
40      * @return Collection of all children nodes.
41      */
42     abstract Collection<? extends NodeModification> getChildren();
43 }