code: private Object toActualNumber(Double value, Type type) {
          if (type.equals(Byte.class)) return value.byteValue();
          if (type.equals(Short.class)) return value.shortValue();
          if (type.equals(Integer.class)) return value.intValue();
          if (type.equals(Long.class)) return value.longValue();
          if (type.equals(Float.class)) return value.floatValue();
          if (type.equals(Double.class)) return value;
          if (type.equals(BigInteger.class)) return BigInteger.valueOf(value.longValue());
          if (type.equals(BigDecimal.class)) return BigDecimal.valueOf(value);
  
          return value;
      }
docs: but I'm going to rely on the user to not do anything silly