Merge "Revert "BUG-1097: implemented check for null or empty list in builder classes.""
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / Int32.java
index 799ca00d0c39f3439f3ab1309696fa8f9bbe2d75..d42768bc71b14b2ffc88008673a049d8dc4e5a85 100644 (file)
@@ -7,37 +7,33 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
+import org.opendaylight.yangtools.concepts.Immutable;
 
 /**
  * Implementation of Yang int32 built-in type. <br>
  * int32 represents integer values between -2147483648 and 2147483647,
  * inclusively. The Java counterpart of Yang int32 built-in type is
  * {@link Integer}.
- * 
+ *
  * @see AbstractSignedInteger
- * 
+ *
  */
-public final class Int32 extends AbstractSignedInteger {
-    private static Int32 instance;
-    private static final QName NAME = BaseTypes.constructQName("int32");
+public final class Int32 extends AbstractSignedInteger implements Immutable {
     private static final String DESCRIPTION = "int32  represents integer values between -2147483648 and 2147483647, inclusively.";
 
+
+    private static final Int32 INSTANCE = new Int32();
+
     private Int32() {
-        super(Int32.NAME, Int32.DESCRIPTION, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
+        super(BaseTypes.INT32_QNAME, Int32.DESCRIPTION, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
     }
 
+    /**
+     * Returns default instance of int32 type.
+     * @return default instance of int32 type.
+     */
     public static Int32 getInstance() {
-        if (instance == null) {
-            instance = new Int32();
-        }
-        return instance;
-    }
-
-    @Override
-    public IntegerTypeDefinition getBaseType() {
-        return this;
+        return INSTANCE;
     }
 
     @Override
@@ -47,6 +43,7 @@ public final class Int32 extends AbstractSignedInteger {
 
     @Override
     public String toString() {
-        return "type " + NAME;
+        return "type " + BaseTypes.INT32_QNAME;
     }
+
 }