X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2FEmptyNodeWrapper.java;h=f93a0aea70fa311a7dd0b6f8ba520d8153f03b89;hp=c146954dcedad184d51181db8f4a4da395b6498c;hb=c1362c86eb19e92e6c64d10099a45deb499c6db1;hpb=3dcdf33c8cbc2eba8b2e6cb0f110a17edfe57ec4 diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java index c146954dce..f93a0aea70 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/EmptyNodeWrapper.java @@ -1,22 +1,26 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ 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.ModifyAction; -import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode; import org.opendaylight.yangtools.yang.data.api.Node; -import org.opendaylight.yangtools.yang.data.api.SimpleNode; import org.opendaylight.yangtools.yang.data.impl.NodeFactory; -import com.google.common.base.Preconditions; - public final class EmptyNodeWrapper implements NodeWrapper>, Node { - + private Node unwrapped; - + private String localName; private URI namespace; private QName name; @@ -26,22 +30,27 @@ public final class EmptyNodeWrapper implements NodeWrapper>, Node 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) { @@ -49,7 +58,7 @@ public final class EmptyNodeWrapper implements NodeWrapper>, Node } return localName; } - + @Override public URI getNamespace() { if (unwrapped != null) { @@ -59,11 +68,16 @@ public final class EmptyNodeWrapper implements NodeWrapper>, Node } @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; } + @Override + public boolean isChangeAllowed() { + return unwrapped == null ? true : false; + } + @Override public Node unwrap() { if (unwrapped == null) { @@ -89,6 +103,7 @@ public final class EmptyNodeWrapper implements NodeWrapper>, Node } @Override + @Deprecated public CompositeNode getParent() { return unwrap().getParent(); } @@ -104,7 +119,7 @@ public final class EmptyNodeWrapper implements NodeWrapper>, Node } @Override - public Void setValue(Void value) { + public Void setValue(final Void value) { return null; }