Introduce yangtools.binding.meta
[yangtools.git] / common / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / Uint64.java
index 038c5cb795fb2c0dab3f11dacf134b02352b1d4e..d7e5e3a8290cb554fe2d2f87a472457e59971f94 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.common;
 
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.annotations.Beta;
 import com.google.common.collect.Interner;
 import com.google.common.collect.Interners;
 import com.google.common.primitives.UnsignedLong;
@@ -21,11 +20,8 @@ import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.concepts.Either;
 
 /**
- * Dedicated type for YANG's 'type uint64' type.
- *
- * @author Robert Varga
+ * Dedicated type for YANG's {@code type uint64} type.
  */
-@Beta
 @NonNullByDefault
 public class Uint64 extends Number implements CanonicalValue<Uint64> {
     public static final class Support extends AbstractCanonicalValueSupport<Uint64> {
@@ -403,7 +399,7 @@ public class Uint64 extends Number implements CanonicalValue<Uint64> {
      */
     public final Uint8 toUint8() {
         if ((value & 0xFFFFFFFFFFFFFF00L) != 0) {
-            UintConversions.throwIAE(toString(), 255);
+            throw iae(toString(), 255);
         }
         return Uint8.fromByteBits((byte) value);
     }
@@ -416,7 +412,7 @@ public class Uint64 extends Number implements CanonicalValue<Uint64> {
      */
     public final Uint16 toUint16() {
         if ((value & 0xFFFFFFFFFFFF0000L) != 0) {
-            UintConversions.throwIAE(toString(), 65535);
+            throw iae(toString(), 65535);
         }
         return Uint16.fromShortBits((short) value);
     }
@@ -429,11 +425,16 @@ public class Uint64 extends Number implements CanonicalValue<Uint64> {
      */
     public final Uint32 toUint32() {
         if ((value & 0xFFFFFFFF00000000L) != 0) {
-            UintConversions.throwIAE(toString(), 4294967295L);
+            throw iae(toString(), 4294967295L);
         }
         return Uint32.fromIntBits((int) value);
     }
 
+    static IllegalArgumentException iae(final String value, final long max) {
+        // "Invalid range: 65536, expected: [[0..65535]]."
+        return new IllegalArgumentException("Invalid range: " + value + ", expected: [[0.." + max + "]].");
+    }
+
     @Override
     public final int hashCode() {
         return Long.hashCode(value);