bd5a95fa232f33dad994dee0d289663d9cbb657d
[yangtools.git] / yang / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / tree / EmptyDataTreeCandidateNode.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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 com.google.common.base.Preconditions;
12 import com.google.common.collect.ImmutableList;
13 import java.util.Collection;
14 import javax.annotation.Nonnull;
15 import javax.annotation.Nullable;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
17 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18
19 final class EmptyDataTreeCandidateNode implements DataTreeCandidateNode {
20
21     private final PathArgument identifier;
22
23     EmptyDataTreeCandidateNode(final PathArgument identifier) {
24         this.identifier = Preconditions.checkNotNull(identifier, "Identifier should not be null");
25     }
26
27     @Nonnull
28     @Override
29     public PathArgument getIdentifier() {
30         return identifier;
31     }
32
33     @Nonnull
34     @Override
35     public Collection<DataTreeCandidateNode> getChildNodes() {
36         return ImmutableList.of();
37     }
38
39     @Nullable
40     @Override
41     public DataTreeCandidateNode getModifiedChild(final PathArgument identifier) {
42         return null;
43     }
44
45     @Nonnull
46     @Override
47     public ModificationType getModificationType() {
48         return ModificationType.UNMODIFIED;
49     }
50
51     @Nonnull
52     @Override
53     public Optional<NormalizedNode<?, ?>> getDataAfter() {
54         return Optional.absent();
55     }
56
57     @Nonnull
58     @Override
59     public Optional<NormalizedNode<?, ?>> getDataBefore() {
60         return Optional.absent();
61     }
62 }