Use Uint constants in base types 57/92857/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 2 Oct 2020 14:13:14 +0000 (16:13 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 2 Oct 2020 14:13:14 +0000 (16:13 +0200)
Rather than using valueOf(), use exposed ZERO and MAX_VALUE,
improving initialization speed just a little.

Change-Id: Ib6938c039bdf8773d6000f9eb6b56cf8f01ae1d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint16Type.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint32Type.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint64Type.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint8Type.java

index 1e950791c07348819dc40c9c97879e1105aa4b55..39ead259f41ee7ed4548b8613c960ba3bf826599 100644 (file)
@@ -17,7 +17,7 @@ final class BaseUint16Type extends AbstractRangeRestrictedBaseType<Uint16TypeDef
     static final @NonNull BaseUint16Type INSTANCE = new BaseUint16Type();
 
     private BaseUint16Type() {
-        super(BaseTypes.UINT16_QNAME, Uint16.valueOf(0), Uint16.valueOf(65535));
+        super(BaseTypes.UINT16_QNAME, Uint16.ZERO, Uint16.MAX_VALUE);
     }
 
     @Override
index bdf3ccdc6068182bf17d69494921f5a69a1998ce..e4ada104a3109a9d98603c609fc2712f039af00d 100644 (file)
@@ -17,7 +17,7 @@ final class BaseUint32Type extends AbstractRangeRestrictedBaseType<Uint32TypeDef
     static final @NonNull BaseUint32Type INSTANCE = new BaseUint32Type();
 
     private BaseUint32Type() {
-        super(BaseTypes.UINT32_QNAME, Uint32.valueOf(0), Uint32.valueOf(4294967295L));
+        super(BaseTypes.UINT32_QNAME, Uint32.ZERO, Uint32.MAX_VALUE);
     }
 
     @Override
index 2b6043f5ef80b0fa00f2c9f29ddda5ea60dd8cbe..02ea1f8d9d79317bf686c2f99ef224eef51cb9c9 100644 (file)
@@ -17,7 +17,7 @@ final class BaseUint64Type extends AbstractRangeRestrictedBaseType<Uint64TypeDef
     static final @NonNull BaseUint64Type INSTANCE = new BaseUint64Type();
 
     private BaseUint64Type() {
-        super(BaseTypes.UINT64_QNAME, Uint64.valueOf(0), Uint64.valueOf("18446744073709551615"));
+        super(BaseTypes.UINT64_QNAME, Uint64.ZERO, Uint64.MAX_VALUE);
     }
 
     @Override
index 2a3d481208f7ae45c90015f5bc6c7818f582b6da..5c33c0c141a441885b4a8db08732f0399f2f0c3c 100644 (file)
@@ -17,7 +17,7 @@ final class BaseUint8Type extends AbstractRangeRestrictedBaseType<Uint8TypeDefin
     static final @NonNull BaseUint8Type INSTANCE = new BaseUint8Type();
 
     private BaseUint8Type() {
-        super(BaseTypes.UINT8_QNAME, Uint8.valueOf(0), Uint8.valueOf(255));
+        super(BaseTypes.UINT8_QNAME, Uint8.ZERO, Uint8.MAX_VALUE);
     }
 
     @Override