MDSAL-320 Mapping type collisions between yang built-in uint* and int*
[mdsal.git] / binding2 / mdsal-binding2-java-api-generator / src / main / java / org / opendaylight / mdsal / binding / javav2 / java / api / generator / rangeGenerators / Uint64RangeGenerator.java
diff --git a/binding2/mdsal-binding2-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/javav2/java/api/generator/rangeGenerators/Uint64RangeGenerator.java b/binding2/mdsal-binding2-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/javav2/java/api/generator/rangeGenerators/Uint64RangeGenerator.java
new file mode 100644 (file)
index 0000000..32752de
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.binding.javav2.java.api.generator.rangeGenerators;
+
+import com.google.common.primitives.UnsignedLong;
+import java.math.BigInteger;
+import org.opendaylight.yangtools.yang.common.Uint64;
+
+final class Uint64RangeGenerator extends AbstractUnsignedIntegerRangeGenerator<Uint64> {
+    Uint64RangeGenerator() {
+        super(Uint64.class, Uint64.class.getName(), Uint64.valueOf(0), Uint64.fromUnsignedLong(
+            UnsignedLong.fromLongBits(0xffffffffffffffffL)));
+    }
+
+    @Override
+    protected Uint64 convert(final Number value) {
+        return Uint64.valueOf(BigInteger.class.cast(value));
+    }
+}
\ No newline at end of file