2 * Copyright (c) 2015, 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.data.tree.spi;
10 import static java.util.Objects.requireNonNull;
12 import java.util.Optional;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.DistinctNodeContainer;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17 import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
19 abstract class AbstractDataTreeCandidateNode implements DataTreeCandidateNode {
20 private final DistinctNodeContainer<PathArgument, NormalizedNode> data;
22 AbstractDataTreeCandidateNode(final DistinctNodeContainer<PathArgument, NormalizedNode> data) {
23 this.data = requireNonNull(data);
27 public final PathArgument getIdentifier() {
28 return data.getIdentifier();
31 final @NonNull Optional<NormalizedNode> dataOptional() {
32 return Optional.of(data);
35 final DistinctNodeContainer<PathArgument, NormalizedNode> data() {
40 public String toString() {
41 return this.getClass().getSimpleName() + "{data = " + this.data + "}";