|
Oracle Fusion Middleware extensions for Applications Core API Reference 11g Release 1 (11.1.1.5) E22562-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.apps.fnd.applcore.i18n.text.NumberFormatter
public abstract class NumberFormatter
NumberFormatter is an abstract class which defines the method for number formatting based on the user preferences.
The APIs should be called only the case ADF Faces number formatting function cannot be utilize.
Rounding
NumberFormatter uses half-even rounding (see java.math.BigDecimal.ROUND_HALF_EVEN) for formatting.
Synchronization
NumberFormatter and its subclasses are generally not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally.
Example
NumberFormatter formatter = NumberFormatter.getInstance(FormatUtil .getI18NContext(ApplSessionUtil.getSession())); //or //NumberFormatter formatter = // FormatUtil.getNumberFormatterInstance(ApplSessionUtil.getSession()); BigDecimal number = new BigDecimal("-12345.67"); String formattedString = formatter.format(number); Number parsedNumber = formatter.parse(formattedString);
Constructor Summary | |
---|---|
NumberFormatter()
|
Method Summary | |
---|---|
abstract java.lang.String |
format(java.lang.Number numericValue)
Returns formatted string from Number value based on user preferences. |
static NumberFormatter |
getInstance(I18NContext context)
Returns NumberFormatter instance. |
static NumberFormatter |
getInstance(I18NContext context,
java.lang.String formatMask,
java.lang.String parseMask)
Returns NumberFormatter instance. |
abstract java.lang.Number |
parse(java.lang.String text)
Returns Number object parsed from String value. |
abstract void |
setGroupingUsed(boolean newValue)
Set whether or not grouping will be used in this format. |
abstract void |
setMaximumFractionDigits(int newValue)
Sets the maximum number of digits allowed in the fraction portion of a number. |
abstract void |
setMinimumFractionDigits(int newValue)
Sets the minimum number of digits allowed in the fraction portion of a number. |
abstract void |
setMultiplier(int newValue)
Sets the multiplier for use in percent, per mille, and similar formats. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumberFormatter()
Method Detail |
---|
public static NumberFormatter getInstance(I18NContext context)
context
- I18NContext
, I18N context information for the
current session.
NumberFormatter
public static NumberFormatter getInstance(I18NContext context, java.lang.String formatMask, java.lang.String parseMask)
context
- I18NContext
, I18N context information for the
current session.formatMask
- String
, java format mask for formatting.parseMask
- String
, java format mask for parsing.
NumberFormatter
public abstract java.lang.String format(java.lang.Number numericValue)
numericValue
- Number
, numeric value to be formatted.
String
, formatted number.public abstract java.lang.Number parse(java.lang.String text)
text
- String
, to be parsed.
Number
, parsed.public abstract void setMaximumFractionDigits(int newValue)
newValue
- int
, the maximum number of fraction digits to
be shown; if less than zero, then zero is used.public abstract void setGroupingUsed(boolean newValue)
newValue
- boolean
public abstract void setMinimumFractionDigits(int newValue)
newValue
- the minimum number of fraction digits to be shown; if
less than zero, then zero is used. The concrete subclass may enforce an
upper limit to this value appropriate to the numeric type being formatted.public abstract void setMultiplier(int newValue)
Example: with multiplier 100, 1.23 is formatted as "123", and "123" is parsed into 1.23.
|
Oracle Fusion Middleware extensions for Applications Core API Reference 11g Release 1 (11.1.1.5) E22562-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |