|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.nucleus.TimedOperationService atg.nucleus.servlet.ServletService atg.nucleus.servlet.HttpServletService atg.servlet.DynamoServlet atg.droplet.CurrencyFormatter
public class CurrencyFormatter
This droplet can be used to format a numeric amount, within a particular Locale, into a specific currency.
Example:
<importbean bean="/atg/dynamo/droplet/CurrencyFormatter"> <droplet bean="CurrencyFormatter"> <param name="currency" value="param:amount"> <param name="locale" value="bean:/OriginatingRequest.requestLocale.locale"> <oparam name="output"> <valueof param="formattedCurrency">no price</valueof> </oparam> </droplet>Usage:
output
parameter, this is the formatted currency
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.servlet.DynamoServlet |
---|
mAllowCleanupRequest, mParameters |
Fields inherited from class atg.nucleus.servlet.ServletService |
---|
SERVLET_INFO_KEY |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
CurrencyFormatter()
Constructs an instanceof CurrencyFormatter |
Method Summary | |
---|---|
protected java.lang.String |
formatCurrency(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Return the currency formatted in the given Locale as a String. |
protected java.lang.Number |
getCurrency(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns the currency value from the request. |
protected java.util.Locale |
getCurrencyLocale(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns the locale associated with the request. |
java.util.Locale |
getDefaultLocale()
Returns property DefaultLocale. |
protected java.lang.String |
getEuroSymbol(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns the symbol to use when formatting a price in Euros. |
boolean |
isUseRequestLocale()
Returns property UseRequestLocale |
void |
service(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Takes the formatted currency String and sets a request parameter named formattedCurrency , then services the output
parameter. |
void |
setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale |
void |
setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale |
Methods inherited from class atg.servlet.DynamoServlet |
---|
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter |
Methods inherited from class atg.nucleus.servlet.ServletService |
---|
destroy, getServletConfig, getServletInfo, init, setServletInfo |
Methods inherited from class atg.nucleus.TimedOperationService |
---|
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
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
Constructor Detail |
---|
public CurrencyFormatter()
Method Detail |
---|
public void setDefaultLocale(java.util.Locale pDefaultLocale)
public java.util.Locale getDefaultLocale()
public void setUseRequestLocale(boolean pUseRequestLocale)
public boolean isUseRequestLocale()
protected java.lang.Number getCurrency(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
currency
, and if that cannot be found then return 0.0
javax.servlet.ServletException
java.io.IOException
protected java.util.Locale getCurrencyLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
locale
. This value can be
either a java.util.Locale object or a String which represents the locale.
Next if the useRequestLocale
property is true, then the locale
of the request will be returned. Finally, if the locale cannot be determined,
the the defaultLocale
property is used.
javax.servlet.ServletException
java.io.IOException
protected java.lang.String getEuroSymbol(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.ServletException
java.io.IOException
protected java.lang.String formatCurrency(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
getCurrency(request, response)
and getCurrencyLocale(request, response)
methods.
javax.servlet.ServletException
java.io.IOException
public void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
formattedCurrency
, then services the output
parameter.
service
in class DynamoServlet
pRequest
- the request to be processedpResponse
- the response object for this request
javax.servlet.ServletException
- an application specific error occurred
processing this request
java.io.IOException
- an error occurred reading data from the request
or writing data to the response.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |