List of utility methods to do BigDecimal Create
BigDecimal | nullToZero(BigDecimal decimal) Convert null decimal to zero. return decimal == null ? BigDecimal.ZERO : decimal;
|
BigDecimal | nullToZero(BigDecimal num) null To Zero if (num == null) { return new BigDecimal("0"); return num; |
BigDecimal | toBig(Object o) to Big if (o == null || o.toString().equals("") || o.toString().equals("NaN")) { return new BigDecimal(0); return new BigDecimal(o.toString()); |
BigDecimal | toBigDecimal(final Object o) to Big Decimal return toBigDecimal(o, null);
|
BigDecimal | toBigDecimal(final Object value) to Big Decimal try { final Number number = toNumber(value); return new BigDecimal(number.toString()); } catch (Throwable ignored) { return BigDecimal.ZERO; |
BigDecimal | toBigDecimal(Object o) to Big Decimal if (o == null) { return null; BigDecimal bigDecimal; if (o instanceof Byte) { bigDecimal = BigDecimal.valueOf((Byte) o); } else if (o instanceof Short) { bigDecimal = BigDecimal.valueOf((Short) o); ... |
BigDecimal | toBigDecimal(Object obj) to Big Decimal return toBigDecimal(obj, null);
|
BigDecimal | toBigDecimal(String bigDecimal) Wandelt einen BigDecimal im AT Format in einen BigDecimal um return toBigDecimal(bigDecimal, new Locale("de", "AT")); |
BigDecimal | toBigDecimal(String text) Convertesc un string in BigDecimal if (isValidNumber(text)) { ParsePosition p = new ParsePosition(0); Number number = getDecimalFormatter(formaterScale).parse(text, p); return new BigDecimal(number.toString()); } else return null; |
Number | toBigNumber(Number n) Converts the the Number n to either a BigInteger or a BigDecimal , unless the Number is a Float/Double +/- Infinity or NaN, in which case Double#NaN , Double#POSITIVE_INFINITY , or Double#NEGATIVE_INFINITY is returned. if (n instanceof BigDecimal || n instanceof BigInteger) { return n; if (n instanceof Float) { if (((Float) n).isInfinite()) { return n.equals(Float.POSITIVE_INFINITY) ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY; } else if (((Float) n).isNaN()) { return Double.NaN; ... |