|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.core.converter.Formatter org.norther.tammi.spray.engine.tool.FormatTool
public class FormatTool
A request context tool for localized resources.
Constructor Summary | |
---|---|
FormatTool()
Constructs a tool. |
Method Summary | ||
---|---|---|
void |
dispose()
Disposes the object after use. |
|
void |
disposed()
A call back indicating that this instance is not needed any more and can be disposed. |
|
String |
formatCurrency(Number number)
Formats currency. |
|
String |
formatDate(Date date,
String... style)
Formats the specified date. |
|
String |
formatDateTime(Date date,
String... style)
Formats the specified date and time. |
|
String |
formatError(Throwable error)
Formats an error. |
|
String |
formatObject(Object object,
String... pattern)
Formats an object. |
|
String |
formatString(String string,
List<?> arguments)
Formats a string with arguments. |
|
String |
formatTime(Date time,
String... style)
Formats the specified time. |
|
Calendar |
getCalendar()
Gets a calendar. |
|
protected TemplateContext |
getContext()
Gets the target context. |
|
protected ContextToolFilter |
getContextToolFilter()
Gets the context tool filter if available. |
|
String |
getDefaultDatePattern(String className,
String pattern)
Gets a class specific default date format pattern. |
|
Locale |
getDefaultLocale()
Gets the default locale. |
|
protected int |
getEncodingSize()
Gets the encoding size. |
|
String |
getExcelDatePattern(String className,
String pattern)
Gets a class specific Excel date format pattern. |
|
protected
|
getFilter(Class<F> clazz)
Gets the first specific filter from the filter chain. |
|
protected HttpFilterChain |
getFilterChain()
Gets the current filter chain if available. |
|
protected
|
getFilterKey(Class<F> clazz)
Gets the key of the first specific key filter from the filter chain. |
|
int |
getFirstDayOfWeek()
Gets the first day of a week. |
|
String |
getLocalizedDatePattern(String className,
String pattern)
Gets a class specific localized date format pattern. |
|
protected String |
getName()
Gets the bound name. |
|
protected ServletRequest |
getRequest()
Gets the current request if available. |
|
protected ResourceFilter |
getResourceFilter()
Gets the resource filter from the filter stack. |
|
protected ResourceMap |
getResourceMap()
Gets the referent of the resource map MBean. |
|
protected ServletResponse |
getResponse()
Gets the current response if available. |
|
long |
getTime()
Gets the current time in msecs. |
|
protected boolean |
isBound()
Gets the bound state. |
|
boolean |
isDisposed()
Checks whether the recyclable has been disposed. |
|
protected boolean |
isFilterChanged()
Checks whether the current filter has changed since the previous check. |
|
void |
recycle()
Recycles the object for a new client. |
|
void |
recycled(MBeanReference<? extends Pool> instance)
A callback specifying the pool, from which this instance was recycled. |
|
void |
valueBound(ContextBindingEvent event)
Notifies the object that it is being bound to a context. |
|
void |
valueUnbound(ContextBindingEvent event)
Notifies the object that it is being unbound from a context. |
Methods inherited from class org.norther.tammi.core.converter.Formatter |
---|
clearFormats, format, format, formatDate, formatDate, formatDateTime, formatDateTime, formatNumber, formatPercent, formatString, formatTime, formatTime, getCurrencyFormat, getDateFormat, getDateFormat, getLocale, getMBeanServer, getNumberFormat, getNumberFormat, getObject, getObject, getPercentFormat, getString, getString, parseDate, parseDateTime, parseDouble, parseDouble, parseInt, parseInt, parseLong, parseLong, parseTime, resolve, resolve, resolve, resolve, setLocale, toLowerCase, toUpperCase |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FormatTool()
Method Detail |
---|
public void recycle()
Recyclable
recycle
in interface Recyclable
public void dispose()
Recyclable
dispose
in interface Recyclable
public boolean isDisposed()
Recyclable
isDisposed
in interface Recyclable
public void recycled(MBeanReference<? extends Pool> instance)
Poolable
recycled
in interface Poolable
instance
- the pool MBean reference.public void disposed()
Poolable
disposed
in interface Poolable
public String formatString(String string, List<?> arguments)
Formatter
formatString
in class Formatter
string
- the string to format.arguments
- the source objects of the format.
public String formatError(Throwable error)
Formatter
formatError
in class Formatter
error
- the error to format.
public String formatDate(Date date, String... style)
Formatter
formatDate
in class Formatter
date
- the date.style
- the style and timezone.
public String formatTime(Date time, String... style)
Formatter
formatTime
in class Formatter
time
- the time.style
- the style and timezone.
public String formatDateTime(Date date, String... style)
Formatter
formatDateTime
in class Formatter
date
- the date and time.style
- date style, time style and timezone.
public String formatCurrency(Number number)
Formatter
formatCurrency
in class Formatter
number
- the amount to format.
public String formatObject(Object object, String... pattern)
Formatter
formatObject
in class Formatter
object
- the object to format.pattern
- the format pattern and a base name.
public Locale getDefaultLocale()
Formatter
getDefaultLocale
in class Formatter
public String getDefaultDatePattern(String className, String pattern)
className
- the date class name.pattern
- the conversion pattern.
public String getLocalizedDatePattern(String className, String pattern)
className
- the date class name.pattern
- the conversion pattern.
public String getExcelDatePattern(String className, String pattern)
className
- the date class name.pattern
- the conversion pattern.
public Calendar getCalendar()
public int getFirstDayOfWeek()
public long getTime()
public void valueBound(ContextBindingEvent event)
ContextBindingListener
valueBound
in interface ContextBindingListener
event
- the binding event.public void valueUnbound(ContextBindingEvent event)
ContextBindingListener
valueUnbound
in interface ContextBindingListener
event
- the binding event.protected ResourceMap getResourceMap()
Formatter
getResourceMap
in class Formatter
protected ResourceFilter getResourceFilter()
protected ServletRequest getRequest()
protected ServletResponse getResponse()
protected HttpFilterChain getFilterChain()
protected <F extends Filter> F getFilter(Class<F> clazz)
F
- the filter type.clazz
- the class or interface of the filter.
IllegalStateException
- if not found.protected <F extends KeyFilter> String getFilterKey(Class<F> clazz)
F
- the filter type.clazz
- the class or interface of the key filter.
IllegalStateException
- if not found.protected boolean isFilterChanged()
protected TemplateContext getContext()
protected String getName()
protected boolean isBound()
protected int getEncodingSize()
protected ContextToolFilter getContextToolFilter()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |