public class MoneyUtil extends Object
| Constructor and Description |
|---|
MoneyUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areRoundedValuesEqual(BigDecimal value1,
BigDecimal value2) |
static boolean |
areRoundedValuesEqual(double value1,
double value2)
This operation compares two double values for equality.
|
static <T> void |
assignMonetaryConverter(PropertyMetaModel<T> pmm,
boolean editable,
IConvertable<T> node) |
static int |
getMoneyScale()
Use this method for money amount rounding purposes.
|
static RoundingMode |
getRoundingMode()
Use this method for money amount rounding purposes.
|
static boolean |
isRoundedAsZero(BigDecimal value)
Checks if specified amount is zero value, when built-in rounding mode and scale are applied.
|
static void |
main(String[] args) |
static BigDecimal |
parseEuroToBigDecimal(String input)
Parse into a BigDecimal, return null for empty input.
|
static BigDecimal |
parseEuroToBigDecimal(String input,
int scale,
boolean useStrictScale)
Parse into a BigDecimal, return null for empty input.
|
static Double |
parseEuroToDoubleW(String input)
Deprecated.
|
static Double |
parseEuroToDoubleW(String input,
int scale,
boolean useStrictScale)
Deprecated.
|
static <T> T |
parseMoney(Class<T> valueClass,
String in)
Parse a monetary value and return the proper value type, either Double or BigDecimal.
|
static String |
render(BigDecimal v,
boolean thousands,
boolean symbol,
boolean trunk)
Convert the BigDecimal to a formatted monetary value.
|
static String |
render(double v,
boolean thousands,
boolean symbol,
boolean trunk)
Deprecated.
|
static String |
renderAsSimpleDotted(double v)
Deprecated.
|
static String |
renderFullWithSign(BigDecimal v)
Render as a full value: [C -###,###,###.00], including currency sign, thousands separator and all, using the
specified currency locale.
|
static String |
renderFullWithSign(double v)
Deprecated.
|
static String |
renderTruncatedWithSign(BigDecimal v)
Renders as a full value [C -###,###,###.##], but removes the fraction if it is all zeroes.
|
static String |
renderTruncatedWithSign(double v)
Deprecated.
|
static BigDecimal |
roundValue(BigDecimal value) |
static double |
roundValue(double value)
Deprecated.
|
public static <T> T parseMoney(Class<T> valueClass, String in)
T - valueClass - in - public static int getMoneyScale()
public static RoundingMode getRoundingMode()
@Deprecated public static Double parseEuroToDoubleW(String input)
input - @Deprecated public static Double parseEuroToDoubleW(String input, int scale, boolean useStrictScale)
input - scale - in useuseStrictScale - in case of T, if input does not have strict number (defined by scale) of decimal digits after decimal point, it would be rejected as invalid value.public static BigDecimal parseEuroToBigDecimal(String input)
input - public static BigDecimal parseEuroToBigDecimal(String input, int scale, boolean useStrictScale)
input - scale - useStrictScale - in case of T, if input does not have strict number (defined by scale) of decimal digits after decimal point, it would be rejected as invalid value.@Deprecated public static String renderAsSimpleDotted(double v)
v - @Deprecated public static String render(double v, boolean thousands, boolean symbol, boolean trunk)
v - thousands - symbol - trunk - public static String render(BigDecimal v, boolean thousands, boolean symbol, boolean trunk)
v - thousands - Render thousand separators where neededsymbol - Render the currency signtrunk - If the fraction is all zeroes, remove the fraction.@Deprecated public static String renderFullWithSign(double v)
v - public static String renderFullWithSign(BigDecimal v)
v - @Deprecated public static String renderTruncatedWithSign(double v)
v - public static String renderTruncatedWithSign(BigDecimal v)
v - public static void main(String[] args)
@Deprecated public static double roundValue(double value)
value - @Nonnull public static BigDecimal roundValue(@Nonnull BigDecimal value)
public static boolean areRoundedValuesEqual(double value1,
double value2)
value1 - value2 - public static boolean areRoundedValuesEqual(@Nonnull BigDecimal value1, @Nonnull BigDecimal value2)
public static boolean isRoundedAsZero(@Nonnull BigDecimal value)
value - public static <T> void assignMonetaryConverter(PropertyMetaModel<T> pmm, boolean editable, IConvertable<T> node)
Copyright © 2017 etc.to. All rights reserved.