code: @SuppressWarnings("unchecked")
      public static <D extends Number> D valueOf(Class < D > clazz, String str) {
          if (clazz.equals(Short.class)) {
              return (D) Short.valueOf(intPart(str));
          } else if (clazz.equals(Integer.class)) {
              return (D) Integer.valueOf(intPart(str));
          } else if (clazz.equals(Long.class)) {
              return (D) Long.valueOf(intPart(str));
          } else if (clazz.equals(BigDecimal.class)) {
              return (D) new BigDecimal(str);
          } else if (clazz.equals(BigInteger.class)) {
              return (D) new BigInteger(intPart(str));
          }
          throw new IllegalArgumentException("Unsupported java type " + clazz);
      }
docs: Given a string representation of a numeric value, convert that to the
  target java Number type.
  <p/>
  If the target is an integer type, we trim any fractional part.
  
  @param clazz the java Number type
  @param str the string representation of a numeric value
  @return the java Number obtained from the input string
  @throws NumberFormatException if umber cannot be derived from the input
  string