Home » Mojarra-2.0.1 » javax » faces » convert » [javadoc | source]
javax.faces.convert
public class: NumberConverter [javadoc | source]
java.lang.Object
   javax.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:

The getAsString() method expects a value of type java.lang.Number (or a subclass), and creates a formatted String according to the following algorithm:

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 Number fails. The message format string for this message may optionally include the following placeholders:

  • {0} replaced by the unconverted value.
  • {1} replaced by an example value.
  • {2} replaced by a String whose value is the label of the input component that produced this message.

 
public static final  String NUMBER_ID   

The message identifier of the javax.faces.application.FacesMessage to be created if the conversion to Number fails. The message format string for this message may optionally include the following placeholders:

  • {0} replaced by the unconverted value.
  • HA
  • {1} replaced by an example value.
  • {2} replaced by a String whose value is the label of the input component that produced this message.

 
public static final  String PATTERN_ID   

The message identifier of the javax.faces.application.FacesMessage to be created if the conversion to Number fails. The message format string for this message may optionally include the following placeholders:

  • {0} replaced by the unconverted value.
  • {1} replaced by an example value.
  • {2} replaced by a String whose value is the label of the input component that produced this message.

 
public static final  String PERCENT_ID   

The message identifier of the javax.faces.application.FacesMessage to be created if the conversion to Number fails. The message format string for this message may optionally include the following placeholders:

  • {0} replaced by the unconverted value.
  • {1} replaced by an example value.
  • {2} replaced by a String whose value is the label of the input component that produced this message.

 
public static final  String STRING_ID   

The message identifier of the javax.faces.application.FacesMessage to be created if the conversion of the Number value to String fails. The message format string for this message may optionally include the following placeholders:

  • {0} relaced by the unconverted value.
  • {1} replaced by a String whose value is the label of the input component that produced this message.

 
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:
 public  void clearInitialState() 
 public Object getAsObject(FacesContext context,
    UIComponent component,
    String value) 
 public String getAsString(FacesContext context,
    UIComponent component,
    Object value) 
 public String getCurrencyCode() 

    Return the ISO 4217 currency code used by getAsString() with a type of currency. If not set, the value used will be based on the formatting Locale.

 public String getCurrencySymbol() 

    Return the currency symbol used by getAsString() with a type of currency. If not set, the value used will be based on the formatting Locale.

 public Locale getLocale() 

    Return the Locale to be used when parsing numbers. If this value is null, the Locale stored in the javax.faces.component.UIViewRoot for the current request will be utilized.

 public int getMaxFractionDigits() 

    Return the maximum number of digits getAsString() should render in the fraction portion of the result.

 public int getMaxIntegerDigits() 

    Return the maximum number of digits getAsString() should render in the integer portion of the result.

 public int getMinFractionDigits() 

    Return the minimum number of digits getAsString() should render in the fraction portion of the result.

 public int getMinIntegerDigits() 

    Return the minimum number of digits getAsString() should render in the integer portion of the result.

 public String getPattern() 

    Return the format pattern to be used when formatting and parsing numbers.

 public String getType() 

    Return the number type to be used when formatting and parsing numbers. If not modified, the default type is number.

 public boolean initialStateMarked() 
 public boolean isGroupingUsed() 

    Return true if getAsString should include grouping separators if necessary. If not modified, the default value is true.

 public boolean isIntegerOnly() 

    Return true if only the integer portion of the given value should be returned from getAsObject(). If not modified, the default value is false.

 public boolean isTransient() 
 public  void markInitialState() 
 public  void restoreState(FacesContext context,
    Object state) 
 public Object saveState(FacesContext context) 
 public  void setCurrencyCode(String currencyCode) 

    Set the ISO 4217 currency code used by getAsString() with a type of currency.

 public  void setCurrencySymbol(String currencySymbol) 

    Set the currency symbol used by getAsString() with a type of currency.

 public  void setGroupingUsed(boolean groupingUsed) 

    Set the flag indicating whether getAsString() should include grouping separators if necessary.

 public  void setIntegerOnly(boolean integerOnly) 

    Set to true if only the integer portion of the given value should be returned from getAsObject().

 public  void setLocale(Locale locale) 

    Set the Locale to be used when parsing numbers. If set to null, the Locale stored in the javax.faces.component.UIViewRoot for the current request will be utilized.

 public  void setMaxFractionDigits(int maxFractionDigits) 

    Set the maximum number of digits getAsString() should render in the fraction portion of the result. If not set, the number of digits depends on the value being converted.

 public  void setMaxIntegerDigits(int maxIntegerDigits) 

    Set the maximum number of digits getAsString() should render in the integer portion of the result. If not set, the number of digits depends on the value being converted.

 public  void setMinFractionDigits(int minFractionDigits) 

    Set the minimum number of digits getAsString() should render in the fraction portion of the result. If not set, the number of digits depends on the value being converted.

 public  void setMinIntegerDigits(int minIntegerDigits) 

    Set the minimum number of digits getAsString() should render in the integer portion of the result. If not set, the number of digits depends on the value being converted.

 public  void setPattern(String pattern) 

    Set the format pattern to be used when formatting and parsing numbers. Valid values are those supported by java.text.DecimalFormat. An invalid value will cause a ConverterException when getAsObject() or getAsString() is called.

 public  void setTransient(boolean transientFlag) 
 public  void setType(String type) 

    Set the number type to be used when formatting and parsing numbers. Valid values are currency, number, or percent. An invalid value will cause a ConverterException when getAsObject() or getAsString() is called.