X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2FSimpleNodeWrapper.java;h=3131668ed9ed23ae8fb8f0edb75076c8635a235d;hb=92f1fd15e99ce5b9e52612c0b52f70cd661b99cc;hp=97f8102127c2b71f69aaf729aeeeed598043aed0;hpb=9212fed678702583f4a555641208cf1c7b45b829;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java index 97f8102127..3131668ed9 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/SimpleNodeWrapper.java @@ -1,3 +1,10 @@ +/* + * 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 java.net.URI; @@ -12,9 +19,9 @@ import org.opendaylight.yangtools.yang.data.impl.NodeFactory; import com.google.common.base.Preconditions; public final class SimpleNodeWrapper implements NodeWrapper>, SimpleNode { - + private SimpleNode simpleNode; - + private String localName; private Object value; private URI namespace; @@ -24,18 +31,23 @@ public final class SimpleNodeWrapper implements NodeWrapper>, Simp this.localName = Preconditions.checkNotNull(localName); this.value = value; } - + public SimpleNodeWrapper(URI namespace, String localName, Object value) { this(localName, value); this.namespace = namespace; } - + @Override public void setQname(QName name) { Preconditions.checkState(simpleNode == null, "Cannot change the object, due to data inconsistencies."); this.name = name; } - + + @Override + public QName getQname() { + return name; + } + @Override public String getLocalName() { if (simpleNode != null) { @@ -43,7 +55,7 @@ public final class SimpleNodeWrapper implements NodeWrapper>, Simp } return localName; } - + @Override public URI getNamespace() { if (simpleNode != null) { @@ -58,6 +70,11 @@ public final class SimpleNodeWrapper implements NodeWrapper>, Simp this.namespace = namespace; } + @Override + public boolean isChangeAllowed() { + return simpleNode == null ? true : false; + } + @Override public SimpleNode unwrap() { if (simpleNode == null) { @@ -66,7 +83,7 @@ public final class SimpleNodeWrapper implements NodeWrapper>, Simp name = new QName(namespace, localName); } simpleNode = NodeFactory.createImmutableSimpleNode(name, null, value); - + value = null; namespace = null; localName = null; @@ -109,7 +126,7 @@ public final class SimpleNodeWrapper implements NodeWrapper>, Simp public Object setValue(Object value) { return unwrap().setValue(value); } - + }