|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cc.framework.convert.imp.NumberConverter
Converter for Numbers (as in the Java Server Faces Specification) 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:
Field Summary | |
static java.lang.String |
CONVERTER_ID
Converter Id |
private static java.lang.Class |
currencyClass
|
private java.lang.String |
currencyCode
|
private java.lang.String |
currencySymbol
|
private static java.lang.Class[] |
GET_INSTANCE_PARAM_TYPES
|
private boolean |
groupingUsed
|
private boolean |
integerOnly
|
private java.util.Locale |
locale
|
private int |
maxFractionDigits
|
private boolean |
maxFractionDigitsSpecified
|
private int |
maxIntegerDigits
|
private boolean |
maxIntegerDigitsSpecified
|
private int |
minFractionDigits
|
private boolean |
minFractionDigitsSpecified
|
private int |
minIntegerDigits
|
private boolean |
minIntegerDigitsSpecified
|
private java.lang.String |
pattern
|
private java.lang.String |
type
|
Constructor Summary | |
NumberConverter()
Constructor |
Method Summary | |
private void |
configureCurrency(java.text.NumberFormat formatter)
|
private void |
configureFormatter(java.text.NumberFormat formatter)
|
java.lang.Object |
getAsObject(RequestContext context,
java.lang.String value)
Converts the given String value into the Converters Datatype |
java.lang.String |
getAsString(RequestContext context,
java.lang.Object value)
Converts the Object of the converters Datatype into it's String representation |
java.lang.String |
getCurrencyCode()
|
java.lang.String |
getCurrencySymbol()
|
private java.util.Locale |
getLocale(RequestContext context)
Retrieves the Locale for this Converter |
int |
getMaxFractionDigits()
|
int |
getMaxIntegerDigits()
|
int |
getMinFractionDigits()
|
int |
getMinIntegerDigits()
|
private java.text.NumberFormat |
getNumberFormat(java.util.Locale locale)
|
java.lang.String |
getPattern()
|
java.lang.String |
getType()
|
boolean |
isGroupingUsed()
|
boolean |
isIntegerOnly()
|
void |
restoreState(RequestContext context,
java.lang.Object state)
Perform any processing required to restore the state from the entries in the state Object. |
java.lang.Object |
saveState(RequestContext context)
Gets the state of the instance as a Serializable Object. |
void |
setCurrencyCode(java.lang.String currencyCode)
|
void |
setCurrencySymbol(java.lang.String currencySymbol)
|
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 |
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 |
public static final java.lang.String CONVERTER_ID
private java.lang.String currencyCode
private java.lang.String currencySymbol
private boolean groupingUsed
private boolean integerOnly
private int maxFractionDigits
private boolean maxFractionDigitsSpecified
private int maxIntegerDigits
private boolean maxIntegerDigitsSpecified
private int minFractionDigits
private boolean minFractionDigitsSpecified
private int minIntegerDigits
private boolean minIntegerDigitsSpecified
private java.util.Locale locale
private java.lang.String pattern
private java.lang.String type
private static java.lang.Class currencyClass
private static final java.lang.Class[] GET_INSTANCE_PARAM_TYPES
Constructor Detail |
public NumberConverter()
Method Detail |
public java.lang.String getCurrencyCode()
public void setCurrencyCode(java.lang.String currencyCode)
currencyCode
- ISO 4217 currency code, applied only when formatting
currencies.public java.lang.String getCurrencySymbol()
public void setCurrencySymbol(java.lang.String currencySymbol)
currencySymbol
- Currency symbol, applied only when formatting currencies.public boolean isGroupingUsed()
public void setGroupingUsed(boolean groupingUsed)
groupingUsed
- Flag specifying whether formatted output will contain grouping
separators. Expressions must evaluate to a boolean. Default
value is true.public boolean isIntegerOnly()
public void setIntegerOnly(boolean integerOnly)
integerOnly
- Flag specifying whether only the integer part of the value
will be formatted and parsed. Expressions must evaluate to a
boolean. Default value is false.public int getMaxFractionDigits()
public void setMaxFractionDigits(int maxFractionDigits)
maxFractionDigits
- Maximum number of digits that will be formatted in the
fractional portion of the output. Expressions must evaluate to
an int.public int getMaxIntegerDigits()
public void setMaxIntegerDigits(int maxIntegerDigits)
maxIntegerDigits
- Maximum number of digits that will be formatted in the integer
portion of the output. Expressions must evaluate to an int.public int getMinFractionDigits()
public void setMinFractionDigits(int minFractionDigits)
minFractionDigits
- Minimum number of digits that will be formatted in the
fractional portion of the output. Expressions must evaluate to
an int.public int getMinIntegerDigits()
public void setMinIntegerDigits(int minIntegerDigits)
minIntegerDigits
- Minimum number of digits that will be formatted in the integer
portion of the output. Expressions must evaluate to an int.public void setLocale(java.util.Locale locale)
locale
- Locale whose predefined styles for numbers are used during
formatting and parsing. If not specified, the Locale returned
by FacesContext.getViewRoot().getLocale() will be used.
Expressions must evaluate to a java.util.Locale.public java.lang.String getPattern()
public void setPattern(java.lang.String pattern)
pattern
- Custom formatting pattern which determins how the number
string should be formatted and parsed.public java.lang.String getType()
public void setType(java.lang.String type)
type
- Specifies how the number string will be formatted and parsed.
Valid values are "number", "currency", and "percentage".
Default value is "number".public java.lang.Object getAsObject(RequestContext context, java.lang.String value) throws ConverterException
Converter
getAsObject
in interface Converter
context
- Request Contextvalue
- The String Value to convert
ConverterException
- is thrown when a conversion error occursConverter.getAsObject(com.cc.framework.adapter.RequestContext, java.lang.String)
public java.lang.String getAsString(RequestContext context, java.lang.Object value) throws ConverterException
Converter
getAsString
in interface Converter
context
- Request Contextvalue
- The Object to convert
ConverterException
- is thrown when a conversion error occursConverter.getAsString(com.cc.framework.adapter.RequestContext, java.lang.Object)
private void configureCurrency(java.text.NumberFormat formatter) throws java.lang.Exception
java.lang.Exception
private void configureFormatter(java.text.NumberFormat formatter)
private java.util.Locale getLocale(RequestContext context)
context
- The RequestContext
private java.text.NumberFormat getNumberFormat(java.util.Locale locale) throws ConverterException
ConverterException
public java.lang.Object saveState(RequestContext context)
StatefullConverter
Object state = component.saveState(ctx);Component should be the same as before executing it.
saveState
in interface StatefullConverter
context
- The RequestContext object
StatefullConverter.saveState(com.cc.framework.adapter.RequestContext)
public void restoreState(RequestContext context, java.lang.Object state)
StatefullConverter
restoreState
in interface StatefullConverter
context
- The RequestContext objectstate
- the serialized stateStatefullConverter.restoreState(com.cc.framework.adapter.RequestContext, java.lang.Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |