1cf28a36d1bdc2fcb162467d118e631293eaf7c2
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / store / impl / tree / spi / AbstractTreeNode.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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.controller.md.sal.dom.store.impl.tree.spi;
9
10 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
11 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
12
13 import com.google.common.base.Preconditions;
14 import com.google.common.primitives.UnsignedLong;
15
16 /*
17  * A very basic data tree node.
18  */
19 abstract class AbstractTreeNode implements TreeNode {
20     private final NormalizedNode<?, ?> data;
21     private final UnsignedLong version;
22
23     protected AbstractTreeNode(final NormalizedNode<?, ?> data, final UnsignedLong version) {
24         this.data = Preconditions.checkNotNull(data);
25         this.version = Preconditions.checkNotNull(version);
26     }
27
28     @Override
29     public PathArgument getIdentifier() {
30         return data.getIdentifier();
31     }
32
33     @Override
34     public final UnsignedLong getVersion() {
35         return version;
36     }
37
38     @Override
39     public final NormalizedNode<?, ?> getData() {
40         return data;
41     }
42 }