Merge "BUG-614: migrate RuntimeGeneratedInvoker"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / SimpleNodeWrapper.java
index 97f8102127c2b71f69aaf729aeeeed598043aed0..3131668ed9ed23ae8fb8f0edb75076c8635a235d 100644 (file)
@@ -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<?>>, SimpleNode<Object> {
-    
+
     private SimpleNode<Object> simpleNode;
-    
+
     private String localName;
     private Object value;
     private URI namespace;
@@ -24,18 +31,23 @@ public final class SimpleNodeWrapper implements NodeWrapper<SimpleNode<?>>, 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<SimpleNode<?>>, Simp
         }
         return localName;
     }
-    
+
     @Override
     public URI getNamespace() {
         if (simpleNode != null) {
@@ -58,6 +70,11 @@ public final class SimpleNodeWrapper implements NodeWrapper<SimpleNode<?>>, Simp
         this.namespace = namespace;
     }
 
+    @Override
+    public boolean isChangeAllowed() {
+        return simpleNode == null ? true : false;
+    }
+
     @Override
     public SimpleNode<Object> unwrap() {
         if (simpleNode == null) {
@@ -66,7 +83,7 @@ public final class SimpleNodeWrapper implements NodeWrapper<SimpleNode<?>>, 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<SimpleNode<?>>, Simp
     public Object setValue(Object value) {
         return unwrap().setValue(value);
     }
-    
+
 
 
 }