Do not attempt to construct invalid QNames
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / restconf / rest / services / impl / FakeLeafSchemaNode.java
similarity index 88%
rename from restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/impl/LeafSchemaNodeImpl.java
rename to restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/rest/services/impl/FakeLeafSchemaNode.java
index 13a3190896babdfbbb34ad4616ad9f09f708c71d..81bbc47d8adeb8e4b853ee37a05d807a8286ce91 100644 (file)
@@ -21,24 +21,19 @@ import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
  * Special case only use by GET restconf/operations (since moment of old Yang
  * parser and old yang model API removal) to build and use fake leaf like child
  * in container
- *
  */
-class LeafSchemaNodeImpl implements LeafSchemaNode {
+final class FakeLeafSchemaNode implements LeafSchemaNode {
 
     private final SchemaPath path;
-    private final QName qname;
 
     /**
      * Base values for fake leaf schema node
      *
-     * @param basePath
-     *            - schema path
      * @param qname
      *            - qname
      */
-    LeafSchemaNodeImpl(final SchemaPath basePath, final QName qname) {
-        this.path = basePath.createChild(qname);
-        this.qname = qname;
+    FakeLeafSchemaNode(final QName qname) {
+        this.path = FakeContainerSchemaNode.PATH.createChild(qname);
     }
 
     @Override
@@ -63,12 +58,12 @@ class LeafSchemaNodeImpl implements LeafSchemaNode {
 
     @Override
     public QName getQName() {
-        return this.qname;
+        return path.getLastComponent();
     }
 
     @Override
     public SchemaPath getPath() {
-        return this.path;
+        return path;
     }
 
     @Override