public final class BigDecimalUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkIfCorrectDecimalValue(Entity entity,
String decimalFieldName) |
static BigDecimal |
convertNullToOne(Object value)
Converts value, if null returns one
|
static BigDecimal |
convertNullToZero(Object value)
Converts value, if null returns zero
|
static BigDecimal |
toPercent(BigDecimal decimalValue,
MathContext mathContext)
Converts decimal value to percent
|
static String |
toString(BigDecimal decimal,
int maximumFractionDigits) |
static <any> |
tryParse(String maybeStringWithDecimal,
Locale locale)
Try parse string into BigDecimal.
|
static <any> |
tryParseAndIgnoreSeparator(String maybeStringWithDecimal,
Locale locale) |
static boolean |
valueEquals(BigDecimal d1,
BigDecimal d2)
Check if decimals represent the same numeric value, even if they have
different precisions or contexts.
|
public static boolean checkIfCorrectDecimalValue(Entity entity, String decimalFieldName)
public static BigDecimal convertNullToOne(Object value)
value - valuepublic static BigDecimal convertNullToZero(Object value)
value - valuepublic static BigDecimal toPercent(BigDecimal decimalValue, MathContext mathContext)
decimalValue - decimal valuepublic static String toString(BigDecimal decimal, int maximumFractionDigits)
public static <any> tryParse(String maybeStringWithDecimal, Locale locale)
maybeStringWithDecimal - String to be parsed as a BigDecimal numberlocale - locale to be used when parse.public static <any> tryParseAndIgnoreSeparator(String maybeStringWithDecimal, Locale locale)
public static boolean valueEquals(BigDecimal d1, BigDecimal d2)
d1 - first BigDecimal to compared2 - second decimal to compareCopyright © 2010-2025 Qcadoo Limited