Name
NumberConverter
Synopsis
An instance of this class is
used as a
Converter
for Double
and
Long
values.
Synopsis
Class name: |
javax.faces.convert.NumberConverter |
Extends: |
None |
Implements: |
|
Fields
-
public static final String CONVERTER_ID
The identifier for this converter:
javax.faces.Number
.
Constructors
-
public NumberConverter()
Creates an instance.
Methods
-
public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)
Converts the provided
String
value (which can benull
) to aNumber
instance and returns the new instance. Returnsnull
if the value isnull
or an empty string (after trimming); otherwise, parses the value in the same way asjava.text.DecimalFormat
, guided by the component’spattern
,integerOnly
andtype
attributes for theLocale
specified by the component’slocale
attribute or the view’sLocale
. Throws aConverterException
if the conversion fails.-
public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)
Converts the provided
Number
value (which can benull
) to aString
instance and returns the new instance, formatted in the same way as byjava.text.DecimalFormat
, guided by the component’spattern
,currencyCode
,currencySymbol
,groupingUsed
,maxIntegerDigits
,minIntegerDisgits
,maxFractionDigits
,minFractionDigits
, andtype
attributes for theLocale
specified by the ...
Get JavaServer Faces now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.