|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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(Object date,
String style,
String timezone)
Formats the specified with style and time zone. |
String |
formatDateTime(Object date,
String dstyle,
String tstyle,
String timezone)
Formats the specified date and time with style and time zone. |
String |
formatError(Throwable error)
Formats an error. |
String |
formatString(String string,
List arguments)
Formats a string with arguments. |
String |
formatTime(Object time,
String style,
String timezone)
Formats the specified time with style and time zone. |
Calendar |
getCalendar()
Gets a calendar. |
protected TemplateContext |
getContext()
Gets the target context. |
protected ContextToolFilter |
getContextToolFilter()
Gets the context tool filter if available. |
Locale |
getDefaultLocale()
Gets the default locale. |
protected Filter |
getFilter(Class clazz)
Gets the first specific filter from the filter chain. |
protected HttpFilterChain |
getFilterChain()
Gets the current filter chain if available. |
protected String |
getFilterKey(Class clazz)
Gets the key of the first specific key filter from the filter chain. |
int |
getFirstDayOfWeek()
Gets the first day of a week. |
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. |
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 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, formatDate, formatDate, formatDate, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatDateTime, formatNumber, formatNumber, formatPercent, formatString, formatTime, formatTime, formatTime, formatTime, formatTime, getDateFormat, getLocale, getMBeanServer, getNumberFormat, getObject, getObject, getString, getString, parseDate, parseDate, parseDateTime, parseDateTime, parseDouble, parseDouble, parseInt, parseInt, parseLong, parseLong, parseTime, parseTime, resolve, resolve, resolve, 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 Recyclablepublic void dispose()
Recyclable
dispose in interface Recyclablepublic boolean isDisposed()
Recyclable
isDisposed in interface Recyclablepublic void recycled(MBeanReference instance)
Poolable
recycled in interface Poolableinstance - the pool MBean reference.public void disposed()
Poolable
disposed in interface Poolable
public String formatString(String string,
List arguments)
Formatter
formatString in class Formatterstring - the string to format.arguments - the source objects of the format.
public String formatError(Throwable error)
Formatter
formatError in class Formattererror - the error to format.
public String formatDate(Object date,
String style,
String timezone)
Formatter
formatDate in class Formatterdate - the date or milliseconds.style - default, short, medium, long or full.timezone - the timezone.
public String formatTime(Object time,
String style,
String timezone)
Formatter
formatTime in class Formattertime - the time or milliseconds.style - default, short, medium, long or full.timezone - the timezone.
public String formatDateTime(Object date,
String dstyle,
String tstyle,
String timezone)
Formatter
formatDateTime in class Formatterdate - the date and time or milliseconds.dstyle - default, short, medium, long or full for date.tstyle - default, short, medium, long or full for time.timezone - the timezone.
public String formatCurrency(Number number)
Formatter
formatCurrency in class Formatternumber - the amount to format.
public Locale getDefaultLocale()
Formatter
getDefaultLocale in class Formatterpublic Calendar getCalendar()
public int getFirstDayOfWeek()
public void valueBound(ContextBindingEvent event)
ContextBindingListener
valueBound in interface ContextBindingListenerevent - the binding event.public void valueUnbound(ContextBindingEvent event)
ContextBindingListener
valueUnbound in interface ContextBindingListenerevent - the binding event.protected ResourceMap getResourceMap()
Formatter
getResourceMap in class Formatterprotected ResourceFilter getResourceFilter()
protected ServletRequest getRequest()
protected ServletResponse getResponse()
protected HttpFilterChain getFilterChain()
protected Filter getFilter(Class clazz)
clazz - the class or interface of the filter.
IllegalStateException - if not found.protected String getFilterKey(Class clazz)
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 ContextToolFilter getContextToolFilter()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||