2 * Copyright (c) 2014 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.spi;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.base.MoreObjects;
13 import com.google.common.base.MoreObjects.ToStringHelper;
14 import org.eclipse.jdt.annotation.NonNullByDefault;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19 * A very basic data tree node. Contains some versioned data.
22 abstract class AbstractTreeNode implements TreeNode {
23 private final NormalizedNode data;
24 private final Version version;
26 protected AbstractTreeNode(final NormalizedNode data, final Version version) {
27 this.data = requireNonNull(data);
28 this.version = requireNonNull(version);
32 public final PathArgument getIdentifier() {
33 return data.getIdentifier();
37 public final Version getVersion() {
42 public final NormalizedNode getData() {
47 public final String toString() {
48 return addToStringAttributes(MoreObjects.toStringHelper(this).add("version", version)).toString();
51 protected abstract ToStringHelper addToStringAttributes(ToStringHelper helper);