|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.droplet.CurrencyTagConverter
public class CurrencyTagConverter
A tag converter which is used to parse and format currency amounts.
An example of this is as follows:
<valueof param="priceInfo.amount" currency>no price</valueof>
You can also specify a locale the currency should be rendered with:
<valueof param="priceInfo.amount" currency locale="en_US">no price</valueof>
If no locale is specified then the converter first looks for a request parameter named locale.
This parameter can either be a java.util.Locale object or a String which names a locale. If this
cannot be found then we fetch the locale from the RequestLocale.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
static java.lang.String |
NAME
|
Constructor Summary | |
---|---|
CurrencyTagConverter()
Constructs an instanceof CurrencyTagConverter |
Method Summary | |
---|---|
java.lang.String |
convertObjectToString(DynamoHttpServletRequest pRequest,
java.lang.Object pValue,
java.util.Properties pAttributes)
Converts the supplied Object value to a String value. |
java.lang.Object |
convertStringToObject(DynamoHttpServletRequest pRequest,
java.lang.String pValue,
java.util.Properties pAttributes)
Converts the supplied String value to an Object value. |
static java.lang.String |
formatCurrency(java.lang.Object pCurrency,
java.util.Locale pLocale)
Return the supplied currency formatted in the given Locale as a String. |
static java.text.NumberFormat |
getCurrencyFormat(java.util.Locale pLocale)
Return a NumberFormat object which can be used to format currency based on the given Locale |
java.util.Locale |
getDefaultLocale()
Returns property DefaultLocale. |
java.lang.String |
getName()
Returns the unique name for the TagConverter. |
static java.text.NumberFormat |
getNumberFormat(java.util.Locale pLocale)
|
TagAttributeDescriptor[] |
getTagAttributeDescriptors()
Returns the list of TagAttributeDescriptors which are used by this converter. |
boolean |
isUseRequestLocale()
Returns property UseRequestLocale |
void |
setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale |
void |
setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
public static final java.lang.String NAME
Constructor Detail |
---|
public CurrencyTagConverter()
Method Detail |
---|
public void setDefaultLocale(java.util.Locale pDefaultLocale)
public java.util.Locale getDefaultLocale()
public void setUseRequestLocale(boolean pUseRequestLocale)
public boolean isUseRequestLocale()
public java.lang.String getName()
getName
in interface TagConverter
public TagAttributeDescriptor[] getTagAttributeDescriptors()
getTagAttributeDescriptors
in interface TagConverter
public java.lang.Object convertStringToObject(DynamoHttpServletRequest pRequest, java.lang.String pValue, java.util.Properties pAttributes) throws TagConversionException
convertStringToObject
in interface TagConverter
pRequest
- the request object for this conversion. This object
can be null if the conversion is not performed in the context of
a request.pAttributes
- The list of attributes in the tag that is invoking
this converter.pValue
- The original String value to be converted.
TagConversionException
- if the conversion failed.public java.lang.String convertObjectToString(DynamoHttpServletRequest pRequest, java.lang.Object pValue, java.util.Properties pAttributes) throws TagConversionException
convertObjectToString
in interface TagConverter
pRequest
- the request this conversion applies to. You can use
this request to obtain the RequestLocale to localize the conversion
process. This can be null if the conversion is not performed in
the context of a request.pValue
- the Object value to be converted to a StringpAttributes
- the set of attributes supplied in this tag
declaration.
TagConversionException
public static java.text.NumberFormat getCurrencyFormat(java.util.Locale pLocale)
public static java.text.NumberFormat getNumberFormat(java.util.Locale pLocale)
public static java.lang.String formatCurrency(java.lang.Object pCurrency, java.util.Locale pLocale)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |