Added validation of range and length constraints.
[controller.git] / opendaylight / sal / yang-prototype / yang / yang-model-util / src / main / java / org / opendaylight / controller / yang / model / util / Uint64.java
index 05ea8c9e0983f98687a950fc8c2cffbc841c1328..e95a6232dbb0102e48db2a9e721c106bc87fe98a 100644 (file)
@@ -8,12 +8,9 @@
 package org.opendaylight.controller.yang.model.util;
 
 import java.math.BigInteger;
-import java.net.URI;
-import java.util.Date;
-import java.util.List;
 
 import org.opendaylight.controller.yang.common.QName;
-import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
+import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefinition;
 
 /**
@@ -23,30 +20,16 @@ import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefini
  * {@link BigInteger}.
  *
  */
-public class Uint64 extends AbstractUnsignedInteger {
-
+public final class Uint64 extends AbstractUnsignedInteger {
+    public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615");
     private static final QName name = BaseTypes.constructQName("uint64");
+    private final BigInteger defaultValue = null;
+    private static final String description = "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";
+    private final UnsignedIntegerTypeDefinition baseType;
 
-    private BigInteger defaultValue = null;
-    private static final String description =
-            "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";
-
-    public Uint64(final List<String> actualPath,
-            final URI namespace, final Date revision) {
-        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
-    }
-
-    public Uint64(final List<String> actualPath,
-            final URI namespace, final Date revision, final BigInteger defaultValue) {
-        super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
-        this.defaultValue = defaultValue;
-    }
-
-    public Uint64(final List<String> actualPath,
-            final URI namespace, final Date revision, final List<RangeConstraint> rangeStatements,
-            final String units, final BigInteger defaultValue) {
-        super(actualPath, namespace, revision, name, description, rangeStatements, units);
-        this.defaultValue = defaultValue;
+    public Uint64(final SchemaPath path) {
+        super(path, name, description, MAX_VALUE, "");
+        this.baseType = this;
     }
 
     /*
@@ -57,7 +40,7 @@ public class Uint64 extends AbstractUnsignedInteger {
      */
     @Override
     public UnsignedIntegerTypeDefinition getBaseType() {
-        return this;
+        return baseType;
     }
 
     /*
@@ -76,8 +59,7 @@ public class Uint64 extends AbstractUnsignedInteger {
     public int hashCode() {
         final int prime = 31;
         int result = super.hashCode();
-        result = prime * result
-                + ((defaultValue == null) ? 0 : defaultValue.hashCode());
+        result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode());
         return result;
     }
 
@@ -113,4 +95,5 @@ public class Uint64 extends AbstractUnsignedInteger {
         builder.append("]");
         return builder.toString();
     }
+
 }