addGenerator(b, new IntegerRangeGenerator());
addGenerator(b, new LongRangeGenerator());
addGenerator(b, new BigDecimalRangeGenerator());
- addGenerator(b, new BigIntegerRangeGenerator());
addGenerator(b, new Uint8RangeGenerator());
addGenerator(b, new Uint16RangeGenerator());
addGenerator(b, new Uint32RangeGenerator());
+++ /dev/null
-/*
- * Copyright (c) 2015 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.java.api.generator;
-
-import java.math.BigInteger;
-
-final class BigIntegerRangeGenerator extends AbstractBigRangeGenerator<BigInteger> {
- BigIntegerRangeGenerator() {
- super(BigInteger.class);
- }
-
- @Override
- protected String format(final BigInteger value) {
- if (BigInteger.ZERO.equals(value)) {
- return "java.math.BigInteger.ZERO";
- }
- if (BigInteger.ONE.equals(value)) {
- return "java.math.BigInteger.ONE";
- }
- if (BigInteger.TEN.equals(value)) {
- return "java.math.BigInteger.TEN";
- }
-
- // Check for conversion to long
- final long l = value.longValue();
- if (value.equals(BigInteger.valueOf(l))) {
- return "java.math.BigInteger.valueOf(" + l + "L)";
- }
-
- return "new java.math.BigInteger(\"" + value.toString() + "\")";
- }
-
- @Override
- @Deprecated
- protected BigInteger convert(final Number value) {
- return BigInteger.valueOf(value.longValue());
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 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.java.api.generator;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.math.BigInteger;
-import org.junit.Test;
-
-public class BigIntegerRangeGeneratorTest {
- @Test
- public void basicTest() throws Exception {
- BigIntegerRangeGenerator generator = new BigIntegerRangeGenerator();
- assertEquals(BigInteger.valueOf(1L), generator.convert(1L));
- assertNotNull(generator.format(BigInteger.ONE));
- assertNotNull(generator.format(BigInteger.TEN));
- assertNotNull(generator.format(BigInteger.valueOf(2L)));
- }
-}
\ No newline at end of file