public class StringFormatter extends Object
Constructor and Description |
---|
StringFormatter(ResourceBundle bundle)
Construct a StringFormatter...
|
StringFormatter(ResourceBundle bundle,
Locale locale)
Construct a StringFormatter...
|
Modifier and Type | Method and Description |
---|---|
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) |
MessageFormat |
getFormat(String pattern) |
String |
getLocalized(String key)
Access a localized string associated with key from the ResourceBundle,
likely the UI.properties file.
|
ResourceBundle |
getResourceBundle()
return
ResourceBundle set to this object. |
static String |
join(String delim,
String... stuff) |
String |
spaceToNBSP(String input)
Convert... spaces to
|
public StringFormatter(ResourceBundle bundle)
bundle
- ResourceBundle to lookup patterns for MessageFormat
objects.public StringFormatter(ResourceBundle bundle, Locale locale)
bundle
- ResourceBundle to lookup patterns for MessageFormat
objects.locale
- to use, where applicable with MessageFormat objectspublic ResourceBundle getResourceBundle()
ResourceBundle
set to this object.
(for migration to JSTL.)ResourceBundle
public MessageFormat getFormat(String pattern)
public String getLocalized(String key)
key
- to lookup in the ResourceBundlepublic String format(String key)
key
- String property name in UI.properties file to use as the
pattern for the MessageFormatpublic 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 keypublic 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 keypublic 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 keypublic 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 keypublic String escapeHtml(String raw)
Intended for JSP use. Otherwise use StringEscapeUtils.escapeHtml(String)
instead.
raw
- string to be escapedpublic String escapeJavaScript(String raw)
Intended for JSP use. Otherwise use StringEscapeUtils.escapeJavaScript(String)
instead.
raw
- string to be escapedpublic String spaceToNBSP(String input)
input
- to replaceCopyright © 2005–2015 IIPC. All rights reserved.