test_class.file: beanmother-core/src/test/java/io/beanmother/core/util/NumberUtilsTest.java
test_class.identifier: NumberUtilsTest
test_case.body: @Test
      public void testParseNumber() throws Exception {
          assertEquals(new Integer(1), NumberUtils.parseNumber("1", Integer.class));
          assertEquals(new Byte("1"), NumberUtils.parseNumber("1", Byte.class));
          assertEquals(new Float(1.1), NumberUtils.parseNumber("1.1", Float.class));
          assertEquals(new Double(1.1), NumberUtils.parseNumber("1.1", Double.class));
          assertEquals(new Long(1), NumberUtils.parseNumber("1", Long.class));
          assertEquals(new Short("1"), NumberUtils.parseNumber("1", Short.class));
          assertEquals(new BigInteger("1"), NumberUtils.parseNumber("1", BigInteger.class));
      }
test_case.class_method_signature: NumberUtilsTest.testParseNumber()
test_case.full_signature: @Test public void testParseNumber()
test_case.identifier: testParseNumber
test_case.invocations: assertEquals parseNumber assertEquals parseNumber assertEquals parseNumber assertEquals parseNumber assertEquals parseNumber assertEquals parseNumber assertEquals parseNumber
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testParseNumber()
focal_class.declarator: LONG_MIN = BigInteger.valueOf(Long.MIN_VALUE)
focal_class.modifier: private static final
focal_class.original_string: private static final BigInteger LONG_MIN = BigInteger.valueOf(Long.MIN_VALUE);
focal_class.type: BigInteger
focal_class.var_name: LONG_MIN
focal_class.declarator: LONG_MAX = BigInteger.valueOf(Long.MAX_VALUE)
focal_class.modifier: private static final
focal_class.original_string: private static final BigInteger LONG_MAX = BigInteger.valueOf(Long.MAX_VALUE);
focal_class.type: BigInteger
focal_class.var_name: LONG_MAX
focal_class.declarator: STANDARD_NUMBER_TYPES
focal_class.modifier: public static final
focal_class.original_string: public static final Set<Class<?>> STANDARD_NUMBER_TYPES;
focal_class.type: Set<Class<?>>
focal_class.var_name: STANDARD_NUMBER_TYPES
focal_class.file: beanmother-core/src/main/java/io/beanmother/core/util/NumberUtils.java
focal_class.identifier: NumberUtils
focal_class.class_method_signature: NumberUtils.convertNumberToTargetClass(Number number, Class<T> targetClass)
focal_class.full_signature: @SuppressWarnings("unchecked") public static T convertNumberToTargetClass(Number number, Class<T> targetClass)
focal_class.identifier: convertNumberToTargetClass
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (Number number, Class<T> targetClass)
focal_class.return: T
focal_class.signature: T convertNumberToTargetClass(Number number, Class<T> targetClass)
focal_class.class_method_signature: NumberUtils.checkedLongValue(Number number, Class<? extends Number> targetClass)
focal_class.full_signature: private static long checkedLongValue(Number number, Class<? extends Number> targetClass)
focal_class.identifier: checkedLongValue
focal_class.modifiers: private static
focal_class.parameters: (Number number, Class<? extends Number> targetClass)
focal_class.return: long
focal_class.signature: long checkedLongValue(Number number, Class<? extends Number> targetClass)
focal_class.class_method_signature: NumberUtils.raiseOverflowException(Number number, Class<?> targetClass)
focal_class.full_signature: private static void raiseOverflowException(Number number, Class<?> targetClass)
focal_class.identifier: raiseOverflowException
focal_class.modifiers: private static
focal_class.parameters: (Number number, Class<?> targetClass)
focal_class.return: void
focal_class.signature: void raiseOverflowException(Number number, Class<?> targetClass)
focal_class.class_method_signature: NumberUtils.parseNumber(String text, Class<T> targetClass)
focal_class.full_signature: @SuppressWarnings("unchecked") public static T parseNumber(String text, Class<T> targetClass)
focal_class.identifier: parseNumber
focal_class.modifiers: @SuppressWarnings("unchecked") public static
focal_class.parameters: (String text, Class<T> targetClass)
focal_class.return: T
focal_class.signature: T parseNumber(String text, Class<T> targetClass)
focal_class.class_method_signature: NumberUtils.isHexNumber(String value)
focal_class.full_signature: private static boolean isHexNumber(String value)
focal_class.identifier: isHexNumber
focal_class.modifiers: private static
focal_class.parameters: (String value)
focal_class.return: boolean
focal_class.signature: boolean isHexNumber(String value)
focal_class.class_method_signature: NumberUtils.decodeBigInteger(String value)
focal_class.full_signature: private static BigInteger decodeBigInteger(String value)
focal_class.identifier: decodeBigInteger
focal_class.modifiers: private static
focal_class.parameters: (String value)
focal_class.return: BigInteger
focal_class.signature: BigInteger decodeBigInteger(String value)
focal_class.class_method_signature: NumberUtils.trimAllWhitespace(String str)
focal_class.full_signature: public static String trimAllWhitespace(String str)
focal_class.identifier: trimAllWhitespace
focal_class.modifiers: public static
focal_class.parameters: (String str)
focal_class.return: String
focal_class.signature: String trimAllWhitespace(String str)
focal_method.body: @SuppressWarnings("unchecked")
      public static <T extends Number> T parseNumber(String text, Class<T> targetClass) {
          String trimmed = trimAllWhitespace(text);
  
          if (Byte.class == targetClass) {
              return (T) (isHexNumber(trimmed) ? Byte.decode(trimmed) : Byte.valueOf(trimmed));
          }
          else if (Short.class == targetClass) {
              return (T) (isHexNumber(trimmed) ? Short.decode(trimmed) : Short.valueOf(trimmed));
          }
          else if (Integer.class == targetClass) {
              return (T) (isHexNumber(trimmed) ? Integer.decode(trimmed) : Integer.valueOf(trimmed));
          }
          else if (Long.class == targetClass) {
              return (T) (isHexNumber(trimmed) ? Long.decode(trimmed) : Long.valueOf(trimmed));
          }
          else if (BigInteger.class == targetClass) {
              return (T) (isHexNumber(trimmed) ? decodeBigInteger(trimmed) : new BigInteger(trimmed));
          }
          else if (Float.class == targetClass) {
              return (T) Float.valueOf(trimmed);
          }
          else if (Double.class == targetClass) {
              return (T) Double.valueOf(trimmed);
          }
          else if (BigDecimal.class == targetClass || Number.class == targetClass) {
              return (T) new BigDecimal(trimmed);
          }
          else {
              throw new IllegalArgumentException(
                      "Cannot convert String [" + text + "] to target class [" + targetClass.getName() + "]");
          }
      }
focal_method.class_method_signature: NumberUtils.parseNumber(String text, Class<T> targetClass)
focal_method.full_signature: @SuppressWarnings("unchecked") public static T parseNumber(String text, Class<T> targetClass)
focal_method.identifier: parseNumber
focal_method.invocations: trimAllWhitespace isHexNumber decode valueOf isHexNumber decode valueOf isHexNumber decode valueOf isHexNumber decode valueOf isHexNumber decodeBigInteger valueOf valueOf getName
focal_method.modifiers: @SuppressWarnings("unchecked") public static
focal_method.parameters: (String text, Class<T> targetClass)
focal_method.return: T
focal_method.signature: T parseNumber(String text, Class<T> targetClass)