be663089968fdfe6a689df3fab717984f40e09f7
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / tree / RecursiveUnmodifiedCandidateNode.java
1 /*
2  * Copyright (c) 2015 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 javax.annotation.Nonnull;
11 import com.google.common.base.Optional;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
15 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
17
18 final class RecursiveUnmodifiedCandidateNode extends AbstractRecursiveCandidateNode {
19     protected RecursiveUnmodifiedCandidateNode(final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> data) {
20         super(data);
21     }
22
23     @Override
24     @Nonnull
25     public ModificationType getModificationType() {
26         return ModificationType.UNMODIFIED;
27     }
28
29     @Override
30     public Optional<NormalizedNode<?, ?>> getDataAfter() {
31         return dataOptional();
32     }
33
34     @Override
35     public Optional<NormalizedNode<?, ?>> getDataBefore() {
36         return dataOptional();
37     }
38
39     @Override
40     protected DataTreeCandidateNode createContainer(final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> childData) {
41         return new RecursiveUnmodifiedCandidateNode(childData);
42     }
43
44     @Override
45     protected DataTreeCandidateNode createLeaf(final NormalizedNode<?, ?> childData) {
46         return new UnmodifiedLeafCandidateNode(childData);
47     }
48 }