Bug 4969: NPE in JSONCodecFactory by attempt to find codec for a leafref
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / Int32.java
index b043d40a7ed7b443557e6a34fc3ccd379db0d1bb..1acb55a4ccd9e2d6148a893a61b4b43c5c68eec1 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.concepts.Immutable;
 
 /**
  * Implementation of Yang int32 built-in type. <br>
@@ -16,22 +16,25 @@ import org.opendaylight.yangtools.yang.common.QName;
  * {@link Integer}.
  *
  * @see AbstractSignedInteger
- *
+ * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#int32Type()} instead
  */
-public final class Int32 extends AbstractSignedInteger {
-    private static Int32 instance;
-    private static final QName NAME = BaseTypes.constructQName("int32");
+@Deprecated
+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;
+        return INSTANCE;
     }
 
     @Override
@@ -41,6 +44,7 @@ public final class Int32 extends AbstractSignedInteger {
 
     @Override
     public String toString() {
-        return "type " + NAME;
+        return "type " + BaseTypes.INT32_QNAME;
     }
+
 }