|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.converter.Formatter
public class Formatter
A localized formatter.
Note that the formatter is not thread-safe.
| Constructor Summary | |
|---|---|
Formatter()
Constructs a new formatter. |
|
Formatter(MBeanServer server)
Constructs a new formatter for a specific server. |
|
| Method Summary | |
|---|---|
protected void |
clearFormats()
Clears cached formats. |
String |
format(String key,
List arguments)
Formats a string resource from the default bundle. |
String |
format(String name,
String key,
List arguments)
Formats a string resource from the named bundle. |
String |
formatCurrency(Number number)
Formats currency. |
String |
formatDate()
Formats the current date. |
String |
formatDate(Object date)
Formats the specified date. |
String |
formatDate(Object date,
String style)
Formats the specified date with style. |
String |
formatDate(Object date,
String style,
String timezone)
Formats the specified with style and time zone. |
String |
formatDate(String style)
Formats the current date with style. |
String |
formatDate(String style,
String timezone)
Formats the current date with style and time zone. |
String |
formatDateTime()
Formats the current date and time. |
String |
formatDateTime(Object date)
Formats the specified date and time. |
String |
formatDateTime(Object date,
String dstyle,
String tstyle)
Formats the specified date and time with style. |
String |
formatDateTime(Object date,
String dstyle,
String tstyle,
String timezone)
Formats the specified date and time with style and time zone. |
String |
formatDateTime(String dstyle,
String tstyle)
Formats the current date and time with style. |
String |
formatDateTime(String dstyle,
String tstyle,
String timezone)
Formats the current date and time with style and time zone. |
String |
formatError(Throwable error)
Formats an error. |
String |
formatNumber(Number number)
Formats a number. |
String |
formatNumber(Number number,
String pattern)
Formats a number with a pattern. |
String |
formatPercent(Number number)
Formats percent. |
String |
formatString(String string,
List arguments)
Formats a string with arguments. |
protected String |
formatString(String string,
Object[] args)
Formats a string with arguments. |
String |
formatTime()
Formats the current time. |
String |
formatTime(Object time)
Formats the specified time. |
String |
formatTime(Object time,
String style)
Formats the specified time with style. |
String |
formatTime(Object time,
String style,
String timezone)
Formats the specified time with style and time zone. |
String |
formatTime(String style)
Formats the current time with style. |
String |
formatTime(String style,
String timezone)
Formats the current time with style and time zone. |
DateFormat |
getDateFormat(String pattern)
Gets a date format. |
Locale |
getDefaultLocale()
Gets the default locale. |
Locale |
getLocale()
Gets the locale to apply. |
protected MBeanServer |
getMBeanServer()
Gets a reference to the MBean server. |
NumberFormat |
getNumberFormat(String pattern)
Gets a number format. |
Object |
getObject(String key)
Gets a resource from the default bundle. |
Object |
getObject(String name,
String key)
Gets a resource from the named bundle. |
protected ResourceMap |
getResourceMap()
Gets the referent of the resource map MBean. |
String |
getString(String key)
Gets a string resource from the default bundle. |
String |
getString(String name,
String key)
Gets a string resource from the named bundle. |
Date |
parseDate(String str)
Parses date. |
Date |
parseDate(String str,
String timezone)
Parses date with time zone. |
Date |
parseDateTime(String str)
Parses date and time. |
Date |
parseDateTime(String str,
String timezone)
Parses date and time with time zone. |
double |
parseDouble(String number)
Parses a double number. |
double |
parseDouble(String number,
double error)
Parses a double number. |
int |
parseInt(String number)
Parses an int number. |
int |
parseInt(String number,
int error)
Parses an int number. |
long |
parseLong(String number)
Parses a long number. |
long |
parseLong(String number,
long error)
Parses a long number. |
Date |
parseTime(String str)
Parses time. |
Date |
parseTime(String str,
String timezone)
Parses time with time zone. |
String |
resolve(String key)
Resolves a string resource from the default bundle. |
String |
resolve(String key,
int casep)
Resolves a string resource from the default bundle with the specified case. |
String |
resolve(String key,
List arguments)
Formats a resolved string resource from the default bundle. |
String |
resolve(String key,
List arguments,
int casep)
Formats a resolved string resource from the default bundle with the specified case. |
String |
resolve(String qualifier,
String key)
Resolves a string resource from the qualified bundle. |
String |
resolve(String qualifier,
String key,
int casep)
Resolves a string resource from the qualified bundle with the specified case. |
String |
resolve(String qualifier,
String key,
List arguments)
Formats a resolved string resource from the qualified bundle. |
void |
setLocale(Locale locale)
Sets the locale to apply. |
String |
toLowerCase(String str)
Returns a string in localized lowercase. |
String |
toUpperCase(String str)
Returns a string in localized uppercase. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Formatter()
public Formatter(MBeanServer server)
server - the MBean server.| Method Detail |
|---|
public Object getObject(String key)
key - the key of the resource.
public Object getObject(String name,
String key)
name - the name of the resource bundle.key - the key of the resource.
public String getString(String key)
key - the key of the resource.
public String getString(String name,
String key)
name - the name of the resource bundle.key - the key of the resource.
public String format(String key,
List arguments)
key - the key of the resource.arguments - the source objects of the format.
public String format(String name,
String key,
List arguments)
name - the name of the resource bundle.key - the key of the resource.arguments - the source objects of the format.
public String resolve(String key)
key - the key of the resource.
public String resolve(String qualifier,
String key)
qualifier - the qualifier of the resource bundle.key - the key of the resource.
public String resolve(String key,
List arguments)
key - the key of the resource.arguments - the source objects of the format.
public String resolve(String key,
int casep)
key - the key of the resource.casep - 0 = as is, -1 = lowercase, 1 = uppercase.
public String resolve(String qualifier,
String key,
int casep)
qualifier - the qualifier of the resource bundle.key - the key of the resource.casep - 0 = as is, -1 = lowercase, 1 = uppercase.
public String resolve(String key,
List arguments,
int casep)
key - the key of the resource.arguments - the source objects of the format.casep - 0 = as is, -1 = lowercase, 1 = uppercase.
public String resolve(String qualifier,
String key,
List arguments)
qualifier - the qualifier of the resource bundle.key - the key of the resource.arguments - the source objects of the format.
public String formatString(String string,
List arguments)
string - the string to format.arguments - the source objects of the format.
public String formatError(Throwable error)
error - the error to format.
public String formatDate()
public String formatDate(String style)
style - default, short, medium or long.
public String formatDate(String style,
String timezone)
style - default, short, medium, long or full.timezone - the timezone.
public String formatDate(Object date)
date - the date or milliseconds.
public String formatDate(Object date,
String style)
date - the date or milliseconds.style - default, short, medium, long or full.
public String formatDate(Object date,
String style,
String timezone)
date - the date or milliseconds.style - default, short, medium, long or full.timezone - the timezone.
public String formatTime()
public String formatTime(String style)
style - default, short, medium, long or full.
public String formatTime(String style,
String timezone)
style - default, short, medium, long or full.timezone - the timezone.
public String formatTime(Object time)
time - the time or milliseconds.
public String formatTime(Object time,
String style)
time - the time or milliseconds.style - default, short, medium, long or full.
public String formatTime(Object time,
String style,
String timezone)
time - the time or milliseconds.style - default, short, medium, long or full.timezone - the timezone.
public String formatDateTime()
public String formatDateTime(String dstyle,
String tstyle)
dstyle - default, short, medium, long or full for date.tstyle - default, short, medium, long or full for time.
public String formatDateTime(String dstyle,
String tstyle,
String timezone)
dstyle - default, short, medium, long or full for date.tstyle - default, short, medium, long or full for time.timezone - the timezone.
public String formatDateTime(Object date)
date - the date and time or milliseconds.
public String formatDateTime(Object date,
String dstyle,
String tstyle)
date - the date and time or milliseconds.dstyle - default, short, medium, long or full for date.tstyle - default, short, medium, long or full for time.
public String formatDateTime(Object date,
String dstyle,
String tstyle,
String timezone)
date - 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 formatNumber(Number number)
number - the number to format.
public String formatNumber(Number number,
String pattern)
number - the number to format.pattern - the format pattern.
public String formatCurrency(Number number)
number - the amount to format.
public String formatPercent(Number number)
number - the percent to format.
public Date parseDate(String str)
str - the date string.
public Date parseDate(String str,
String timezone)
str - the date string.timezone - the timezone.
public Date parseTime(String str)
str - the time string.
public Date parseTime(String str,
String timezone)
str - the time string.timezone - the timezone.
public Date parseDateTime(String str)
str - the date string.
public Date parseDateTime(String str,
String timezone)
str - the date string.timezone - the timezone.
public int parseInt(String number)
number - the number string to parse.
public int parseInt(String number,
int error)
number - the number string to parse.error - the value returned for parsing errors.
public long parseLong(String number)
number - the number string to parse.
public long parseLong(String number,
long error)
number - the number string to parse.error - the value returned for parsing errors.
public double parseDouble(String number)
number - the number string to parse.
public double parseDouble(String number,
double error)
number - the number string to parse.error - the value returned for parsing errors.
public Locale getLocale()
public void setLocale(Locale locale)
locale - the locale.public Locale getDefaultLocale()
public DateFormat getDateFormat(String pattern)
pattern - the pattern.
public NumberFormat getNumberFormat(String pattern)
pattern - the pattern.
public String toLowerCase(String str)
str - the string.
public String toUpperCase(String str)
str - the string.
protected String formatString(String string,
Object[] args)
string - the string to format.args - the source objects of the format.
protected void clearFormats()
protected ResourceMap getResourceMap()
protected MBeanServer getMBeanServer()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||