|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.pega.pegarules.pub.util.PerThreadCache
com.pega.pegarules.pub.util.PRNumberFormat
public class PRNumberFormat
PRNumberFormat wraps the ICU number formatting support with a thread-safe implementation geared to PegaRULES conventions.
See http://oss.software.ibm.com/cgi-bin/icu/lx for an page that permits one to explore the settings supplied for each locale.
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT
|
static int |
CURRENCY_PRECISION
Use digits to right of dp as specified by currency |
static java.lang.String |
DEFAULT_CURRENCY
locale-specific default currency format |
static java.lang.String |
DEFAULT_DECIMAL
locale-specific default decimal format |
static java.lang.String |
DEFAULT_DURATION
locale-specific default duration format |
static java.lang.String |
DEFAULT_INTEGER
locale-specific default integer format |
static java.lang.String |
DEFAULT_ORDINAL
locale-specific default ordinal format |
static java.lang.String |
DEFAULT_PERCENT
locale-specific default percent format |
static int |
DEFAULT_PRECISION
Do not set constraints on digits to right of dp. |
static java.lang.String |
DEFAULT_SPELLOUT
locale-specific default spellout format |
static java.lang.String |
VERSION
|
Fields inherited from class com.pega.pegarules.pub.util.PerThreadCache |
---|
USE_DEFAULT_TIMEZONE, USE_DEFAULT_TIMEZONE_PRE42SP6 |
Method Summary | |
---|---|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
com.pega.ibm.icu.math.BigDecimal aValue)
Formats the number using the specified pattern and locale. |
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
double aValue)
Formats the number using the specified pattern and locale. |
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aValue)
Formats the number using the specified pattern and locale. |
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
com.pega.ibm.icu.math.BigDecimal aValue)
Formats the number using the specified pattern and locale. |
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
double aValue)
Formats the number using the specified pattern and locale. |
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
int aDigits,
int aValue)
Formats the number using the specified pattern and locale. |
static com.pega.ibm.icu.util.Currency |
getCurrency(java.util.Locale aLocale,
java.lang.String aCurrency)
Retrieve the desired currency value. |
static com.pega.ibm.icu.util.Currency |
getCurrencyByLocale(java.util.Locale aLocale)
|
static java.util.Set |
getCurrencyCodesForLocale(java.lang.String aLocaleName)
Returns the ISO currency codes for the specified aLocaleName
including multi-level fallback. |
static boolean |
isCurrencyValid(java.lang.String isoCode)
validate that a given currency name is valid. |
static com.pega.ibm.icu.math.BigDecimal |
numberToBigDecimal(java.lang.Number aValue)
Helper function to convert java.lang.Number to ICU BigDecimal, preserving as much accuracy as possible. |
static java.lang.Number |
parse(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
boolean aIntegerOnly,
java.lang.String aString)
Parses the String using the specified pattern and locale as a number. |
static java.lang.Number |
parse(java.lang.String aLocale,
java.lang.String aPattern,
boolean aGroupingUsed,
java.lang.String aCurrency,
boolean aIntegerOnly,
java.lang.String aString)
Parses the String using the specified pattern and locale as a number. |
static com.pega.ibm.icu.math.BigDecimal |
parseLocalizedAsBigDecimal(java.lang.String aLocale,
java.lang.String aString)
Convenience method to parse a value as a BigDecimal, using localized formats |
static double |
parseLocalizedAsDouble(java.lang.String aLocale,
java.lang.String aString)
Convenience method to parse a value as a double, using localized formats |
static int |
parseLocalizedAsInteger(java.lang.String aLocale,
java.lang.String aString)
Convenience method to parse a value as an integer, using localized formats |
Methods inherited from class com.pega.pegarules.pub.util.PerThreadCache |
---|
getDefaultTimeZone, getLocale, getLocaleName, getTimeZone, setDefaultTimeZone |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
public static final java.lang.String VERSION
public static final java.lang.String DEFAULT_DECIMAL
public static final java.lang.String DEFAULT_INTEGER
public static final java.lang.String DEFAULT_CURRENCY
public static final java.lang.String DEFAULT_PERCENT
public static final java.lang.String DEFAULT_DURATION
public static final java.lang.String DEFAULT_ORDINAL
public static final java.lang.String DEFAULT_SPELLOUT
public static final int CURRENCY_PRECISION
public static final int DEFAULT_PRECISION
Method Detail |
---|
public static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaValue
- number to convert
public static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, int aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convert
public static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, double aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaValue
- number to convert
public static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, double aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convert
public static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, com.pega.ibm.icu.math.BigDecimal aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaValue
- number to convert
public static final java.lang.String format(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, int aDigits, com.pega.ibm.icu.math.BigDecimal aValue)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- currency name, if null or blank, the default for the locale is usedaDigits
- digits to right of decimal pointaValue
- number to convert
public static final java.lang.Number parse(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, boolean aIntegerOnly, java.lang.String aString)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaIntegerOnly
- true
if integer only parse desiredaString
- formatted value to convert to number
java.lang.NumberFormatException
- if the String could not be convertedpublic static final java.lang.Number parse(java.lang.String aLocale, java.lang.String aPattern, boolean aGroupingUsed, java.lang.String aCurrency, boolean aIntegerOnly, java.lang.String aString)
aLocale
- locale name, if null or blank, the default locale is usedaPattern
- format patternaGroupingUsed
- true
if grouping should be usedaCurrency
- Currency name, selects explicit currency symbols recognized.aIntegerOnly
- true
if integer only parse desiredaString
- formatted value to convert to number
java.lang.NumberFormatException
- if the String could not be convertedpublic static final int parseLocalizedAsInteger(java.lang.String aLocale, java.lang.String aString)
aLocale
- name of locale whose formats should be usedaString
- String to be parsed
java.lang.NumberFormatException
- if string cannot be parsedpublic static final double parseLocalizedAsDouble(java.lang.String aLocale, java.lang.String aString)
aLocale
- name of locale whose formats should be usedaString
- String to be parsed
java.lang.NumberFormatException
- if string cannot be parsedpublic static final com.pega.ibm.icu.math.BigDecimal parseLocalizedAsBigDecimal(java.lang.String aLocale, java.lang.String aString)
aLocale
- name of locale whose formats should be usedaString
- String to be parsed
java.lang.NumberFormatException
- if string cannot be parsedpublic static final com.pega.ibm.icu.math.BigDecimal numberToBigDecimal(java.lang.Number aValue)
aValue
- Number to be converted
public static final com.pega.ibm.icu.util.Currency getCurrency(java.util.Locale aLocale, java.lang.String aCurrency)
aLocale
- Locale to be used (used if aCurrency omitted)aCurrency
- name of Currency desired
public static com.pega.ibm.icu.util.Currency getCurrencyByLocale(java.util.Locale aLocale)
public static java.util.Set getCurrencyCodesForLocale(java.lang.String aLocaleName)
aLocaleName
including multi-level fallback. That is, if a currency is not found in the
en_US Currencies data, then the en Currencies data will be returned.
aLocaleName
- String
locale name
Set
of String
objects for the ISO 4217
currency codes for the specified localepublic static boolean isCurrencyValid(java.lang.String isoCode)
Adapted from com.ibm.icu.util.Currency. The technique to access currency metadata is icu version specific.
isoCode
- name of currency to validate
true
if valid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |