Update uint implementations a bit 64/84264/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 6 Sep 2019 18:32:22 +0000 (20:32 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 6 Sep 2019 18:32:22 +0000 (20:32 +0200)
Constructor should be private and Integer.toString() is better
than String.valueOf() because it is an intrinsic.

Change-Id: I7e5da76b90add67e479c8d673ad0c696a74907dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Uint16.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Uint32.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Uint64.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Uint8.java

index a3ee5ff4e9c8525d39ba6b3484e08747faff95d5..e174bd9ae12b3362ee1e980b0e01c4262a11618e 100644 (file)
@@ -80,12 +80,12 @@ public class Uint16 extends Number implements CanonicalValue<Uint16> {
 
     private final short value;
 
-    Uint16(final short value) {
+    private Uint16(final short value) {
         this.value = value;
     }
 
     protected Uint16(final Uint16 other) {
-        this.value = other.value;
+        this(other.value);
     }
 
     private static Uint16 instanceFor(final short value) {
@@ -262,7 +262,7 @@ public class Uint16 extends Number implements CanonicalValue<Uint16> {
 
     @Override
     public final String toCanonicalString() {
-        return String.valueOf(intValue());
+        return Integer.toString(intValue());
     }
 
     @Override
index 1fd3e3f10909657a0a72678e192ecdb67b5e67d4..727e17121bfb9eb38b76c51290cf1b810330f98a 100644 (file)
@@ -80,12 +80,12 @@ public class Uint32 extends Number implements CanonicalValue<Uint32> {
 
     private final int value;
 
-    Uint32(final int value) {
+    private Uint32(final int value) {
         this.value = value;
     }
 
     protected Uint32(final Uint32 other) {
-        this.value = other.value;
+        this(other.value);
     }
 
     private static Uint32 instanceFor(final int value) {
index c7793cf12f8def4ae980b832e68880abb4594fe3..b438419b6f354323a565064efbe87f949e7b031b 100644 (file)
@@ -80,12 +80,12 @@ public class Uint64 extends Number implements CanonicalValue<Uint64> {
 
     private final long value;
 
-    Uint64(final long value) {
+    private Uint64(final long value) {
         this.value = value;
     }
 
     protected Uint64(final Uint64 other) {
-        this.value = other.value;
+        this(other.value);
     }
 
     private static Uint64 instanceFor(final long value) {
index 24582406d73834b27c2015e0d94ed75d208678e0..5d47250268d1d5b76c75a453cfc0289d23826d49 100644 (file)
@@ -69,7 +69,7 @@ public class Uint8 extends Number implements CanonicalValue<Uint8> {
     }
 
     protected Uint8(final Uint8 other) {
-        this.value = other.value;
+        this(other.value);
     }
 
     private static Uint8 instanceFor(final byte value) {
@@ -246,7 +246,7 @@ public class Uint8 extends Number implements CanonicalValue<Uint8> {
 
     @Override
     public final String toCanonicalString() {
-        return String.valueOf(intValue());
+        return Integer.toString(intValue());
     }
 
     @Override