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.controller.sal.restconf.impl;
10 import com.google.common.base.Preconditions;
12 import java.util.Collections;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
15 import org.opendaylight.yangtools.yang.data.api.Node;
16 import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
19 * @deprecated class will be removed in Lithium release
22 public final class EmptyNodeWrapper implements NodeWrapper<Node<?>>, Node<Void> {
24 private Node<?> unwrapped;
26 private String localName;
27 private URI namespace;
30 private boolean composite;
32 public boolean isComposite() {
36 public void setComposite(final boolean composite) {
37 this.composite = composite;
40 public EmptyNodeWrapper(final URI namespace, final String localName) {
41 this.localName = Preconditions.checkNotNull(localName);
42 this.namespace = namespace;
46 public void setQname(final QName name) {
47 Preconditions.checkState(unwrapped == null, "Cannot change the object, due to data inconsistencies.");
52 public QName getQname() {
57 public String getLocalName() {
58 if (unwrapped != null) {
59 return unwrapped.getNodeType().getLocalName();
65 public URI getNamespace() {
66 if (unwrapped != null) {
67 return unwrapped.getNodeType().getNamespace();
73 public void setNamespace(final URI namespace) {
74 Preconditions.checkState(unwrapped == null, "Cannot change the object, due to data inconsistencies.");
75 this.namespace = namespace;
79 public boolean isChangeAllowed() {
80 return unwrapped == null ? true : false;
84 public Node<?> unwrap() {
85 if (unwrapped == null) {
87 Preconditions.checkNotNull(namespace);
88 name = new QName(namespace, localName);
91 unwrapped = NodeFactory.createImmutableCompositeNode(name, null, Collections.<Node<?>> emptyList(),
94 unwrapped = NodeFactory.createImmutableSimpleNode(name, null, null);
104 public QName getNodeType() {
105 return unwrap().getNodeType();
110 public CompositeNode getParent() {
111 return unwrap().getParent();
115 public Void getValue() {
120 public QName getKey() {
121 return unwrap().getKey();
125 public Void setValue(final Void value) {