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.api.schema.tree;
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.NormalizedNode;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
18 abstract class AbstractDataTreeCandidateNode implements DataTreeCandidateNode {
19 private final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?,?>> data;
21 AbstractDataTreeCandidateNode(final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> data) {
22 this.data = requireNonNull(data);
26 public final PathArgument getIdentifier() {
27 return data.getIdentifier();
30 final @NonNull Optional<NormalizedNode<?, ?>> dataOptional() {
31 return Optional.of(data);
34 final NormalizedNodeContainer<?, PathArgument, NormalizedNode<?, ?>> data() {
39 public String toString() {
40 return this.getClass().getSimpleName() + "{data = " + this.data + "}";