Modified construction of built-in yang types.
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / BitsType.java
index 717c24ed5083c2b89cc47fd0fa9a6b473aaa4d6d..94391d2288eace0dc4b6d9265d97ee06893e2dcb 100644 (file)
@@ -7,9 +7,7 @@
  */
 package org.opendaylight.controller.yang.model.util;
 
-import java.net.URI;
 import java.util.Collections;
-import java.util.Date;
 import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
@@ -23,8 +21,7 @@ import org.opendaylight.controller.yang.model.api.type.BitsTypeDefinition;
  *
  * @see BitsTypeDefinition
  */
-public class BitsType implements BitsTypeDefinition {
-
+public final class BitsType implements BitsTypeDefinition {
     private final QName name = BaseTypes.constructQName("bits");
     private final SchemaPath path;
     private final String description = "The bits built-in type represents a bit set.  "
@@ -34,27 +31,19 @@ public class BitsType implements BitsTypeDefinition {
     private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.7";
     private final BitsTypeDefinition baseType;
     private final List<Bit> bits;
-    private String units = "";
+    private final String units = "";
 
     /**
      * Default constructor. <br>
      * Instantiates Bits type as empty bits list.
      */
-    private BitsType() {
+    public BitsType(final SchemaPath path) {
         super();
         this.bits = Collections.emptyList();
-        this.path = BaseTypes.schemaPath(name);
+        this.path = path;
         this.baseType = this;
     }
 
-    public BitsType(final List<String> actualPath, final URI namespace,
-            final Date revision) {
-        super();
-        this.bits = Collections.emptyList();
-        this.path = BaseTypes.schemaPath(actualPath, namespace, revision);
-        this.baseType = new BitsType();
-    }
-
     /**
      * Constructor with explicit definition of bits assigned to BitsType.
      *
@@ -64,32 +53,11 @@ public class BitsType implements BitsTypeDefinition {
      * @param bits
      *            The bits assigned for Bits Type
      */
-    public BitsType(final List<String> actualPath, final URI namespace,
-            final Date revision, final List<Bit> bits) {
+    public BitsType(final SchemaPath path, final List<Bit> bits) {
         super();
         this.bits = Collections.unmodifiableList(bits);
-        this.units = "";
-        this.path = BaseTypes.schemaPath(actualPath, namespace, revision);
-        this.baseType = new BitsType();
-    }
-
-    /**
-     * Constructor with explicit definition of bits assigned to BitsType and
-     * Units. <br>
-     * The default value of Bits Type is List of bits.
-     *
-     * @param bits
-     *            The bits assigned for Bits Type
-     * @param units
-     *            units for bits type
-     */
-    public BitsType(final List<String> actualPath, final URI namespace,
-            final Date revision, List<Bit> bits, String units) {
-        super();
-        this.bits = Collections.unmodifiableList(bits);
-        this.units = units;
-        this.path = BaseTypes.schemaPath(actualPath, namespace, revision);
-        this.baseType = new BitsType();
+        this.path = path;
+        this.baseType = this;
     }
 
     /*