org.apache.myfaces.commons.converter
Class AbstractTypedNumberConverter

java.lang.Object
  extended by org.apache.myfaces.commons.converter.ConverterBase
      extended by org.apache.myfaces.commons.converter.AbstractTypedNumberConverter
All Implemented Interfaces:
javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.convert.Converter
Direct Known Subclasses:
TypedNumberConverter

@JSFConverter(name="mcc:convertNumber",
              clazz="org.apache.myfaces.commons.converter.TypedNumberConverter",
              tagClass="org.apache.myfaces.commons.converter.TypedNumberConverterTag",
              tagHandler="org.apache.myfaces.commons.converter.TypedNumberConverterTagHandler",
              serialuidtag="-6592309048440572608L")
public abstract class AbstractTypedNumberConverter
extends ConverterBase

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
           
static java.lang.String CURRENCY_ID
           
static java.lang.String NUMBER_ID
           
static java.lang.String PATTERN_ID
           
static java.lang.String PERCENT_ID
           
static java.lang.String STRING_ID
           
 
Constructor Summary
AbstractTypedNumberConverter()
           
 
Method Summary
 java.lang.Object _getAsObject(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, java.lang.String value)
           
 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.
protected  java.lang.String getLocalCurrencyCode()
           
protected  java.lang.String getLocalCurrencySymbol()
           
 java.util.Locale getLocale()
          The name of the locale to be used, instead of the default as specified in the faces configuration file.
abstract  java.lang.Integer getMaxFractionDigits()
          The maximum number of digits in the fractional portion of the number.
abstract  java.lang.Integer getMaxIntegerDigits()
          The maximum number of digits in the integer portion of the number.
abstract  java.lang.Integer getMinFractionDigits()
          The minimum number of digits in the fractional portion of the number.
abstract  java.lang.Integer getMinIntegerDigits()
          The minimum number of digits in the integer portion of the number.
abstract  java.lang.String getPattern()
          A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat.
abstract  java.lang.String getType()
          The type of formatting/parsing to be performed.
abstract  boolean isGroupingUsed()
          Specifies whether output will contain grouping separators.
abstract  boolean isIntegerOnly()
          Specifies whether only the integer part of the input will be parsed.
 boolean isTransient()
           
 void setCurrencyCode(java.lang.String currencyCode)
           
 void setCurrencySymbol(java.lang.String currencySymbol)
           
 void setDestType(java.lang.Class destType)
           
 void setLocale(java.util.Locale locale)
           
 void setTransient(boolean aTransient)
           
 
Methods inherited from class org.apache.myfaces.commons.converter.ConverterBase
clearInitialState, getDetailMessage, getFacesContext, getFacesMessage, getStateHelper, getStateHelper, getStringValue, getSummaryMessage, getValueExpression, initialStateMarked, markInitialState, restoreAttachedState, restoreState, saveAttachedState, saveState, setDetailMessage, setSummaryMessage, setValueExpression
 
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

STRING_ID

public static final java.lang.String STRING_ID
See Also:
Constant Field Values

CURRENCY_ID

public static final java.lang.String CURRENCY_ID
See Also:
Constant Field Values

NUMBER_ID

public static final java.lang.String NUMBER_ID
See Also:
Constant Field Values

PATTERN_ID

public static final java.lang.String PATTERN_ID
See Also:
Constant Field Values

PERCENT_ID

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

AbstractTypedNumberConverter

public AbstractTypedNumberConverter()
Method Detail

getAsObject

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

getDestType

@JSFProperty
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)

getCurrencyCode

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


getLocalCurrencyCode

protected java.lang.String getLocalCurrencyCode()

setCurrencyCode

public void setCurrencyCode(java.lang.String currencyCode)

getCurrencySymbol

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


getLocalCurrencySymbol

protected java.lang.String getLocalCurrencySymbol()

setCurrencySymbol

public void setCurrencySymbol(java.lang.String currencySymbol)

isGroupingUsed

@JSFProperty(defaultValue="true")
public abstract boolean isGroupingUsed()
Specifies whether output will contain grouping separators. Default: true.


isIntegerOnly

@JSFProperty(defaultValue="false")
public abstract boolean isIntegerOnly()
Specifies whether only the integer part of the input will be parsed. Default: false.


getLocale

@JSFProperty(deferredValueType="java.lang.Object")
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

@JSFProperty
public abstract java.lang.Integer getMaxFractionDigits()
The maximum number of digits in the fractional portion of the number.


getMaxIntegerDigits

@JSFProperty
public abstract java.lang.Integer getMaxIntegerDigits()
The maximum number of digits in the integer portion of the number.


getMinFractionDigits

@JSFProperty
public abstract java.lang.Integer getMinFractionDigits()
The minimum number of digits in the fractional portion of the number.


getMinIntegerDigits

@JSFProperty
public abstract java.lang.Integer getMinIntegerDigits()
The minimum number of digits in the integer portion of the number.


getPattern

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


isTransient

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

setTransient

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

getType

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



Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.