org.apache.myfaces.custom.convertNumber
Class TypedNumberConverter

java.lang.Object
  extended by org.apache.myfaces.custom.convertNumber.TypedNumberConverter
All Implemented Interfaces:
javax.faces.component.StateHolder, javax.faces.convert.Converter

public class TypedNumberConverter
extends java.lang.Object
implements javax.faces.convert.Converter, javax.faces.component.StateHolder

Converter which uses either the manually set destType or the value binding to determine the correct destination type to convert the number to This tag creates a number formatting converter and associates it with the nearest parent UIComponent. It uses either the manually set destType or the value binding to determine the correct destination type to convert the number to. Unless otherwise specified, all attributes accept static values or EL expressions.

Author:
imario@apache.org

Field Summary
static java.lang.String CONVERTER_ID
           
 
Constructor Summary
TypedNumberConverter()
           
 
Method Summary
 java.lang.Object _getAsObject(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, java.lang.String value)
           
 void _restoreState(javax.faces.context.FacesContext facesContext, java.lang.Object state)
           
 java.lang.Object _saveState(javax.faces.context.FacesContext facesContext)
           
 java.lang.Object getAsObject(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, java.lang.String value)
           
 java.lang.String getAsString(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, java.lang.Object value)
           
 java.lang.String getCurrencyCode()
          ISO 4217 currency code
 java.lang.String getCurrencySymbol()
          The currency symbol used to format a currency value.
 java.lang.Class getDestType()
          The java class name the value should be converted to.
 java.util.Locale getLocale()
          The name of the locale to be used, instead of the default as specified in the faces configuration file.
 int getMaxFractionDigits()
          The maximum number of digits in the fractional portion of the number.
 int getMaxIntegerDigits()
          The maximum number of digits in the integer portion of the number.
 int getMinFractionDigits()
          The minimum number of digits in the fractional portion of the number.
 int getMinIntegerDigits()
          The minimum number of digits in the integer portion of the number.
 java.lang.String getPattern()
          A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat.
 java.lang.String getType()
          The type of formatting/parsing to be performed.
 boolean isGroupingUsed()
          Specifies whether output will contain grouping separators.
 boolean isIntegerOnly()
          Specifies whether only the integer part of the input will be parsed.
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext facesContext, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext facesContext)
           
 void setCurrencyCode(java.lang.String currencyCode)
           
 void setCurrencySymbol(java.lang.String currencySymbol)
           
 void setDestType(java.lang.Class destType)
           
 void setGroupingUsed(boolean groupingUsed)
           
 void setIntegerOnly(boolean integerOnly)
           
 void setLocale(java.util.Locale locale)
           
 void setMaxFractionDigits(int maxFractionDigits)
           
 void setMaxIntegerDigits(int maxIntegerDigits)
           
 void setMinFractionDigits(int minFractionDigits)
           
 void setMinIntegerDigits(int minIntegerDigits)
           
 void setPattern(java.lang.String pattern)
           
 void setTransient(boolean aTransient)
           
 void setType(java.lang.String type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONVERTER_ID

public static final java.lang.String CONVERTER_ID
See Also:
Constant Field Values
Constructor Detail

TypedNumberConverter

public TypedNumberConverter()
Method Detail

getAsObject

public java.lang.Object getAsObject(javax.faces.context.FacesContext facesContext,
                                    javax.faces.component.UIComponent uiComponent,
                                    java.lang.String value)
Specified by:
getAsObject in interface javax.faces.convert.Converter

restoreState

public void restoreState(javax.faces.context.FacesContext facesContext,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext facesContext)
Specified by:
saveState in interface javax.faces.component.StateHolder

getDestType

public java.lang.Class getDestType()
The java class name the value should be converted to. Default: automatically determined through valueBinding


setDestType

public void setDestType(java.lang.Class destType)

_getAsObject

public java.lang.Object _getAsObject(javax.faces.context.FacesContext facesContext,
                                     javax.faces.component.UIComponent uiComponent,
                                     java.lang.String value)

getAsString

public java.lang.String getAsString(javax.faces.context.FacesContext facesContext,
                                    javax.faces.component.UIComponent uiComponent,
                                    java.lang.Object value)
Specified by:
getAsString in interface javax.faces.convert.Converter

_restoreState

public void _restoreState(javax.faces.context.FacesContext facesContext,
                          java.lang.Object state)

_saveState

public java.lang.Object _saveState(javax.faces.context.FacesContext facesContext)

getCurrencyCode

public java.lang.String getCurrencyCode()
ISO 4217 currency code


setCurrencyCode

public void setCurrencyCode(java.lang.String currencyCode)

getCurrencySymbol

public java.lang.String getCurrencySymbol()
The currency symbol used to format a currency value. Defaults to the currency symbol for locale.


setCurrencySymbol

public void setCurrencySymbol(java.lang.String currencySymbol)

isGroupingUsed

public boolean isGroupingUsed()
Specifies whether output will contain grouping separators. Default: true.


setGroupingUsed

public void setGroupingUsed(boolean groupingUsed)

isIntegerOnly

public boolean isIntegerOnly()
Specifies whether only the integer part of the input will be parsed. Default: false.


setIntegerOnly

public void setIntegerOnly(boolean integerOnly)

getLocale

public java.util.Locale getLocale()
The name of the locale to be used, instead of the default as specified in the faces configuration file.


setLocale

public void setLocale(java.util.Locale locale)

getMaxFractionDigits

public int getMaxFractionDigits()
The maximum number of digits in the fractional portion of the number.


setMaxFractionDigits

public void setMaxFractionDigits(int maxFractionDigits)

getMaxIntegerDigits

public int getMaxIntegerDigits()
The maximum number of digits in the integer portion of the number.


setMaxIntegerDigits

public void setMaxIntegerDigits(int maxIntegerDigits)

getMinFractionDigits

public int getMinFractionDigits()
The minimum number of digits in the fractional portion of the number.


setMinFractionDigits

public void setMinFractionDigits(int minFractionDigits)

getMinIntegerDigits

public int getMinIntegerDigits()
The minimum number of digits in the integer portion of the number.


setMinIntegerDigits

public void setMinIntegerDigits(int minIntegerDigits)

getPattern

public java.lang.String getPattern()
A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat.


setPattern

public void setPattern(java.lang.String pattern)

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean aTransient)
Specified by:
setTransient in interface javax.faces.component.StateHolder

getType

public java.lang.String getType()
The type of formatting/parsing to be performed. Values include: number, currency, and percentage. Default: number.


setType

public void setType(java.lang.String type)


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.