Cleanup use of Guava library
[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 static java.util.Objects.requireNonNull;
11
12 import com.google.common.collect.ImmutableList;
13 import java.util.Collection;
14 import java.util.Optional;
15 import javax.annotation.Nonnull;
16 import javax.annotation.Nullable;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
18 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19
20 final class EmptyDataTreeCandidateNode implements DataTreeCandidateNode {
21
22     private final PathArgument identifier;
23
24     EmptyDataTreeCandidateNode(final PathArgument identifier) {
25         this.identifier = requireNonNull(identifier, "Identifier should not be null");
26     }
27
28     @Nonnull
29     @Override
30     public PathArgument getIdentifier() {
31         return identifier;
32     }
33
34     @Nonnull
35     @Override
36     public Collection<DataTreeCandidateNode> getChildNodes() {
37         return ImmutableList.of();
38     }
39
40     @Nullable
41     @Override
42     public DataTreeCandidateNode getModifiedChild(final PathArgument identifier) {
43         return null;
44     }
45
46     @Nonnull
47     @Override
48     public ModificationType getModificationType() {
49         return ModificationType.UNMODIFIED;
50     }
51
52     @Nonnull
53     @Override
54     public Optional<NormalizedNode<?, ?>> getDataAfter() {
55         return Optional.empty();
56     }
57
58     @Nonnull
59     @Override
60     public Optional<NormalizedNode<?, ?>> getDataBefore() {
61         return Optional.empty();
62     }
63 }