java.lang.Objectjavax.faces.convert.NumberConverter
All Implemented Interfaces:
PartialStateHolder, Converter
Converter implementation for java.lang.Number
values.
The getAsObject()
method parses a String into an
java.lang.Double
or java.lang.Long
, according
to the following algorithm:
null
. Otherwise, trim leading and trailing
whitespace before proceeding.null
.locale
property is not null,
use that Locale
for managing parsing. Otherwise, use the
Locale
from the UIViewRoot
.pattern
has been specified, its syntax must conform
the rules specified by java.text.DecimalFormat
. Such
a pattern will be used to parse, and the type
property
will be ignored.pattern
has not been specified, parsing will be based
on the type
property, which expects a currency, a number,
or a percent. The parse pattern for currencies, numbers, and
percentages is determined by calling the
getCurrencyInstance()
, getNumberInstance()
,
or getPercentInstance()
method of the
java.text.NumberFormat
class, passing in the selected
Locale
.integerOnly
property has been set to true, only
the integer portion of the String will be parsed. See the JavaDocs
for the setParseIntegerOnly()
method of the
java.text.NumberFormat
class for more information.The getAsString()
method expects a value of type
java.lang.Number
(or a subclass), and creates a formatted
String according to the following algorithm:
locale
property is not null,
use that Locale
for managing formatting. Otherwise, use the
Locale
from the FacesContext
.pattern
has been specified, its syntax must conform
the rules specified by java.text.DecimalFormat
. Such
a pattern will be used to format, and the type
property
(along with related formatting options described in the next paragraph)
will be ignored.pattern
has not been specified, formatting will be
based on the type
property, which formats the value as a
currency, a number, or a percent. The format pattern for currencies,
numbers, and percentages is determined by calling the
percentages is determined by calling the
getCurrencyInstance()
, getNumberInstance()
,
or getPercentInstance()
method of the
java.text.NumberFormat
class, passing in the selected
Locale
. In addition, the following properties will be
applied to the format pattern, if specified:
groupingUsed
property is true
, the
setGroupingUsed(true)
method on the corresponding
NumberFormat
instance will be called.maxFractionDigits
,
maxIntegerDigits
, minFractionDigits
,
and minIntegerDigits
properties.currency
, it is also possible
to configure the currency symbol to be used, using either the
currencyCode
or currencySymbol
properties.
If both are set, the value for currencyCode
takes
precedence on a JDK 1.4 (or later) JVM; otherwise, the value
for currencySymbol
takes precedence.Field Summary | ||
---|---|---|
public static final String | CONVERTER_ID | The standard converter id for this converter. |
public static final String | CURRENCY_ID | The message identifier of the javax.faces.application.FacesMessage to be created if
the conversion to
|
public static final String | NUMBER_ID | The message identifier of the javax.faces.application.FacesMessage to be created if
the conversion to
|
public static final String | PATTERN_ID | The message identifier of the javax.faces.application.FacesMessage to be created if
the conversion to
|
public static final String | PERCENT_ID | The message identifier of the javax.faces.application.FacesMessage to be created if
the conversion to
|
public static final String | STRING_ID | The message identifier of the javax.faces.application.FacesMessage to be created if
the conversion of the
|
Method from javax.faces.convert.NumberConverter Summary: |
---|
clearInitialState, getAsObject, getAsString, getCurrencyCode, getCurrencySymbol, getLocale, getMaxFractionDigits, getMaxIntegerDigits, getMinFractionDigits, getMinIntegerDigits, getPattern, getType, initialStateMarked, isGroupingUsed, isIntegerOnly, isTransient, markInitialState, restoreState, saveState, setCurrencyCode, setCurrencySymbol, setGroupingUsed, setIntegerOnly, setLocale, setMaxFractionDigits, setMaxIntegerDigits, setMinFractionDigits, setMinIntegerDigits, setPattern, setTransient, setType |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from javax.faces.convert.NumberConverter Detail: |
---|
|
|
|
Return the ISO 4217 currency code used by |
Return the currency symbol used by |
Return the |
Return the maximum number of digits |
Return the maximum number of digits |
Return the minimum number of digits |
Return the minimum number of digits |
Return the format pattern to be used when formatting and parsing numbers. |
Return the number type to be used when formatting and parsing numbers.
If not modified, the default type is |
|
Return |
Return |
|
|
|
|
Set the ISO 4217 currency code used by |
Set the currency symbol used by |
Set the flag indicating whether |
Set to |
Set the |
Set the maximum number of digits |
Set the maximum number of digits |
Set the minimum number of digits |
Set the minimum number of digits |
Set the format pattern to be used when formatting and parsing
numbers. Valid values are those supported by
|
|
Set the number type to be used when formatting and parsing numbers.
Valid values are |