Fixed SchemaPath resolution for base YANG types.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / model / parser / builder / impl / UnionTypeBuilder.java
index 50a7a3a1f01a2bf51d1745b04562f62c3a8a57a8..9ab103d71e890696e5ae60367bb48fd5f160906d 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.controller.yang.model.parser.builder.impl;
 
+import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -35,10 +37,19 @@ public class UnionTypeBuilder extends AbstractTypeAwareBuilder implements
     private final List<TypeDefinitionBuilder> typedefs;
     private final UnionType instance;
 
-    public UnionTypeBuilder() {
+    private final List<String> actualPath;
+    private final URI namespace;
+    private final Date revision;
+
+    public UnionTypeBuilder(final List<String> actualPath, final URI namespace,
+            final Date revision) {
         types = new ArrayList<TypeDefinition<?>>();
         typedefs = new ArrayList<TypeDefinitionBuilder>();
-        instance = new UnionType(types);
+        instance = new UnionType(actualPath, namespace, revision, types);
+
+        this.actualPath = actualPath;
+        this.namespace = namespace;
+        this.revision = revision;
     }
 
     public List<TypeDefinition<?>> getTypes() {
@@ -203,6 +214,18 @@ public class UnionTypeBuilder extends AbstractTypeAwareBuilder implements
                 + UnionTypeBuilder.class.getSimpleName());
     }
 
+    public List<String> getActualPath() {
+        return actualPath;
+    }
+
+    public URI getNamespace() {
+        return namespace;
+    }
+
+    public Date getRevision() {
+        return revision;
+    }
+
     @Override
     public String toString() {
         final StringBuilder result = new StringBuilder(