|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ofbiz.base.util.UtilNumber
public class UtilNumber
Field Summary | |
---|---|
static java.lang.String |
module
|
static java.util.HashMap<java.util.Locale,java.lang.String> |
rbnfRuleSets
|
static java.lang.String |
ruleSet_en_US
|
Constructor Summary | |
---|---|
UtilNumber()
|
Method Summary | |
---|---|
static java.lang.String |
formatRuleBasedAmount(double amount,
java.lang.String rule,
java.util.Locale locale)
Method to format an amount using a custom rule set. |
static int |
getBigDecimalRoundingMode(java.lang.String property)
As above, but use the default properties file |
static int |
getBigDecimalRoundingMode(java.lang.String file,
java.lang.String property)
Method to get BigDecimal rounding mode from a property |
static int |
getBigDecimalScale(java.lang.String property)
As above, but use the default properties file |
static int |
getBigDecimalScale(java.lang.String file,
java.lang.String property)
Method to get BigDecimal scale factor from a property |
static int |
roundingModeFromString(java.lang.String value)
Method to get the BigDecimal rounding mode int value from a string name. |
static java.lang.String |
toPercentString(java.lang.Number number,
int scale,
int roundingMode)
Method to turn a number such as "0.9853" into a nicely formatted percent, "98.53%". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String module
public static final java.lang.String ruleSet_en_US
public static java.util.HashMap<java.util.Locale,java.lang.String> rbnfRuleSets
Constructor Detail |
---|
public UtilNumber()
Method Detail |
---|
public static int getBigDecimalScale(java.lang.String file, java.lang.String property)
file
- - Name of the property fileproperty
- - Name of the config property from arithmeticPropertiesFile (e.g., "invoice.decimals")
public static int getBigDecimalScale(java.lang.String property)
public static int getBigDecimalRoundingMode(java.lang.String file, java.lang.String property)
file
- - Name of the property fileproperty
- - Name of the config property from arithmeticPropertiesFile (e.g., "invoice.rounding")
public static int getBigDecimalRoundingMode(java.lang.String property)
public static int roundingModeFromString(java.lang.String value)
value
- - The name of the mode (e.g., "ROUND_HALF_UP")
public static java.lang.String formatRuleBasedAmount(double amount, java.lang.String rule, java.util.Locale locale)
amount
- - the amount to formatrule
- - the name of the rule set to use (e.g., %dollars-and-hundredths)locale
- - the Locale
public static java.lang.String toPercentString(java.lang.Number number, int scale, int roundingMode)
number
- The number object to formatscale
- How many places after the decimal to includeroundingMode
- The BigDecimal rounding mode to apply
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |