*/
package org.opendaylight.controller.sal.restconf.impl;
+import com.google.common.base.Preconditions;
import java.net.URI;
import java.util.Collections;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
-import com.google.common.base.Preconditions;
-
public final class EmptyNodeWrapper implements NodeWrapper<Node<?>>, Node<Void> {
-
+
private Node<?> unwrapped;
-
+
private String localName;
private URI namespace;
private QName name;
public boolean isComposite() {
return composite;
}
-
- public void setComposite(boolean composite) {
+
+ public void setComposite(final boolean composite) {
this.composite = composite;
}
-
- public EmptyNodeWrapper(URI namespace, String localName) {
+
+ public EmptyNodeWrapper(final URI namespace, final String localName) {
this.localName = Preconditions.checkNotNull(localName);
this.namespace = namespace;
}
-
+
@Override
- public void setQname(QName name) {
+ public void setQname(final QName name) {
Preconditions.checkState(unwrapped == null, "Cannot change the object, due to data inconsistencies.");
this.name = name;
}
-
+
@Override
public QName getQname() {
return name;
}
-
+
@Override
public String getLocalName() {
if (unwrapped != null) {
}
return localName;
}
-
+
@Override
public URI getNamespace() {
if (unwrapped != null) {
}
@Override
- public void setNamespace(URI namespace) {
+ public void setNamespace(final URI namespace) {
Preconditions.checkState(unwrapped == null, "Cannot change the object, due to data inconsistencies.");
this.namespace = namespace;
}
Preconditions.checkNotNull(namespace);
name = new QName(namespace, localName);
}
- if(composite) {
- unwrapped = NodeFactory.createImmutableCompositeNode(name, null, Collections.<Node<?>>emptyList(),null);
+ if (composite) {
+ unwrapped = NodeFactory.createImmutableCompositeNode(name, null, Collections.<Node<?>> emptyList(),
+ null);
} else {
unwrapped = NodeFactory.createImmutableSimpleNode(name, null, null);
}
}
@Override
+ @Deprecated
public CompositeNode getParent() {
return unwrap().getParent();
}
}
@Override
- public Void setValue(Void value) {
+ public Void setValue(final Void value) {
return null;
}