|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectto.etc.domui.converter.MoneyUtil
public class MoneyUtil
Utility class to handle all kinds of monetary value presentation and conversion. This parses a monetary amount entered in a string in a very lax way, to allow for maximal ease of use in entering currency amounts. It obeys most of the rules for european (euro) amounts but has a few specials:
Constructor Summary | |
---|---|
MoneyUtil()
|
Method Summary | ||
---|---|---|
static boolean |
areValuesEqual(double value1,
double value2)
This operation compares two double values for equality. |
|
static int |
getMoneyScale()
Use this method for money amount rounding purposes. |
|
static java.math.RoundingMode |
getRoundingMode()
Use this method for money amount rounding purposes. |
|
static void |
main(java.lang.String[] args)
|
|
static java.math.BigDecimal |
parseEuroToBigDecimal(java.lang.String input)
Parse into a BigDecimal, return null for empty input. |
|
static double |
parseEuroToDouble(java.lang.String input)
Deprecated. |
|
static java.lang.Double |
parseEuroToDoubleW(java.lang.String input)
Deprecated. |
|
static
|
parseMoney(java.lang.Class<T> valueClass,
java.lang.String in)
Parse a monetary value and return the proper value type, either Double or BigDecimal. |
|
static java.lang.String |
render(java.math.BigDecimal v,
boolean thousands,
boolean symbol,
boolean trunk)
Convert the BigDecimal to a formatted monetary value. |
|
static java.lang.String |
render(double v,
boolean thousands,
boolean symbol,
boolean trunk)
Deprecated. |
|
static java.lang.String |
renderAsSimpleDotted(double v)
Deprecated. |
|
static java.lang.String |
renderFullWithSign(java.math.BigDecimal v)
Render as a full value: [C -###,###,###.00], including currency sign, thousands separator and all, using the specified currency locale. |
|
static java.lang.String |
renderFullWithSign(double v)
Deprecated. |
|
static java.lang.String |
renderTruncatedWithSign(java.math.BigDecimal v)
Renders as a full value [C -###,###,###.##], but removes the fraction if it is all zeroes. |
|
static java.lang.String |
renderTruncatedWithSign(double v)
Deprecated. |
|
static double |
roundValue(double value)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MoneyUtil()
Method Detail |
---|
public static <T> T parseMoney(java.lang.Class<T> valueClass, java.lang.String in)
T
- valueClass
- in
-
public static int getMoneyScale()
public static java.math.RoundingMode getRoundingMode()
@Deprecated public static double parseEuroToDouble(java.lang.String input)
input
-
@Deprecated public static java.lang.Double parseEuroToDoubleW(java.lang.String input)
input
-
public static java.math.BigDecimal parseEuroToBigDecimal(java.lang.String input)
input
-
@Deprecated public static java.lang.String renderAsSimpleDotted(double v)
v
-
@Deprecated public static java.lang.String render(double v, boolean thousands, boolean symbol, boolean trunk)
v
- thousands
- symbol
- trunk
-
public static java.lang.String render(java.math.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 java.lang.String renderFullWithSign(double v)
v
-
public static java.lang.String renderFullWithSign(java.math.BigDecimal v)
v
-
@Deprecated public static java.lang.String renderTruncatedWithSign(double v)
v
-
public static java.lang.String renderTruncatedWithSign(java.math.BigDecimal v)
v
-
public static void main(java.lang.String[] args)
@Deprecated public static double roundValue(double value)
value
-
public static boolean areValuesEqual(double value1, double value2)
value1
- value2
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |