|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.archive.wayback.util.StringFormatter
public class StringFormatter
An class which assists in UI generation, primarily through Locale-aware String formatting, and also helps in escaping (hopefully properly) Strings for use in HTML. Note that date formatting done through this class forces all times to the UTC timezone - at the moment it appears too confusing to attempt to localize times in any other way..
| Constructor Summary | |
|---|---|
StringFormatter(ResourceBundle bundle,
Locale locale)
Construct a StringFormatter... |
|
| Method Summary | |
|---|---|
String |
escapeHtml(String raw)
handy shortcut to the apache StringEscapeUtils |
String |
escapeJavaScript(String raw)
handy shortcut to the apache StringEscapeUtils |
String |
format(String key)
Localize a string key from the UI.properties file |
String |
format(String key,
Object o1)
|
String |
format(String key,
Object o1,
Object o2)
|
String |
format(String key,
Object o1,
Object o2,
Object o3)
|
String |
format(String key,
Object o1,
Object o2,
Object o3,
Object o4)
|
String |
getLocalized(String key)
Access a localized string associated with key from the ResourceBundle, likely the UI.properties file. |
String |
spaceToNBSP(String input)
Convert... |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringFormatter(ResourceBundle bundle,
Locale locale)
bundle - ResourceBundle to lookup patterns for MessageFormat
objects.locale - to use, where applicable with MessageFormat objects| Method Detail |
|---|
public String getLocalized(String key)
key - to lookup in the ResourceBundle
public String format(String key)
key - String property name in UI.properties file to use as the
pattern for the MessageFormat
public String format(String key,
Object o1)
key - String property name in UI.properties file to use as the
pattern for interpolationo1 - thing1 to interpolate within the MessageFormat
described by the pattern in UI.properties for key key
public String format(String key,
Object o1,
Object o2)
key - String property name in UI.properties file to use as the
pattern for interpolationo1 - thing1 to interpolate within the MessageFormat
described by the pattern in UI.properties for key keyo2 - thing2 to interpolate within the MessageFormat
described by the pattern in UI.properties for key key
public String format(String key,
Object o1,
Object o2,
Object o3)
key - String property name in UI.properties file to use as the
pattern for interpolationo1 - thing1 to interpolate within the MessageFormat
described by the pattern in UI.properties for key keyo2 - thing2 to interpolate within the MessageFormat
described by the pattern in UI.properties for key keyo3 - thing3 to interpolate within the MessageFormat
described by the pattern in UI.properties for key key
public String format(String key,
Object o1,
Object o2,
Object o3,
Object o4)
key - String property name in UI.properties file to use as the
pattern for interpolationo1 - thing1 to interpolate within the MessageFormat
described by the pattern in UI.properties for key keyo2 - thing2 to interpolate within the MessageFormat
described by the pattern in UI.properties for key keyo3 - thing3 to interpolate within the MessageFormat
described by the pattern in UI.properties for key keyo4 - thing4 to interpolate within the MessageFormat
described by the pattern in UI.properties for key key
public String escapeHtml(String raw)
raw - string to be escaped
public String escapeJavaScript(String raw)
raw - string to be escaped
public String spaceToNBSP(String input)
input - to replace
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||