Populate data/ hierarchy
[yangtools.git] / data / yang-data-util / src / main / java / org / opendaylight / yangtools / yang / data / util / SimpleNodeDataWithSchema.java
1 /*
2  * Copyright (c) 2016 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.yangtools.yang.data.util;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
13
14 /**
15  * Utility class used for tracking parser state as needed by a StAX-like parser.
16  * This class is to be used only by respective XML and JSON parsers in yang-data-codec-xml and yang-data-codec-gson.
17  *
18  * <p>
19  * Represents a simple node with value (anyxml, leaf, leaf-list entry).
20  */
21 public abstract class SimpleNodeDataWithSchema<T extends DataSchemaNode> extends AbstractNodeDataWithSchema<T> {
22
23     private Object value;
24
25     public SimpleNodeDataWithSchema(final T dataSchemaNode) {
26         super(dataSchemaNode);
27     }
28
29     public void setValue(final Object value) {
30         this.value = requireNonNull(value);
31     }
32
33     public Object getValue() {
34         return value;
35     }
36 }