|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.x1seven.hydrogen.i18n.I18nUtil
public class I18nUtil
Helper for working with Java ResourceBundles, and for applying value substitution to Strings retrieved from a bundle. An I18nUtil object is created for a named bundle, and optionally a locale. It provides an overloaded getString() method that can be used to retrieve Strings from the bundle, optionally supplying substitution values to be inserted into the message using the standard MessageFormat API.
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_RESOURCE_BUNDLE_NAME
This is the ResourceBundle name to use if none is specified. |
| Constructor Summary | |
|---|---|
I18nUtil(java.lang.Class clazz)
Creates a new I18nUtil object for the default resource bundle name within the same package as the supplied class. |
|
I18nUtil(java.lang.Class clazz,
java.lang.ClassLoader classLoader)
Creates a new I18nUtil object for the default resource bundle name within the same package as the supplied class, and using the supplied ClassLoader. |
|
I18nUtil(java.lang.Class clazz,
java.lang.String resourceBundleName)
Creates a new I18nUtil object for the supplied bundle name and in the same package as the supplied class. |
|
I18nUtil(java.lang.Package pkg)
Creates a new I18nUtil object with the default bundle name and in the same package as the supplied class. |
|
I18nUtil(java.lang.Package pkg,
java.lang.String resourceBundleName)
Creates a new I18nUtil object with for the supplied bundle name and in the supplied package. |
|
I18nUtil(java.lang.String bundleName)
Creates a new I18nUtil object for the named ResourceBundle. |
|
I18nUtil(java.lang.String bundleName,
java.lang.ClassLoader classLoader)
Creates a new I18nUtil object for the named ResourceBundle and the supplied ClassLoader. |
|
I18nUtil(java.lang.String bundleName,
java.util.Locale locale)
Creates a new I18nUtil object for the named ResourceBundle and supplied Locale. |
|
| Method Summary | |
|---|---|
java.lang.Object[] |
buildObjectArray(java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2)
Helper method to build an Object array containing three objects. |
java.lang.Object[] |
buildObjectArray(java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Helper method to build an Object array containing four objects. |
java.lang.Object[] |
buildObjectArray(java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
Helper method to build an Object array containing five objects. |
java.lang.String |
getBundleName()
Returns the name of the ResourceBundle that this I18nUtil object has been set to use. |
java.lang.ClassLoader |
getClassLoader()
Returns the ClassLoader that this I18nUtil object is using to retrieve resources. |
java.util.Locale |
getLocale()
Returns the locale that this I18nUtil object has been set to use. |
java.lang.String |
getString(java.lang.String key)
Retrieves the string identified by the supplied key from this I18nUtil's ResourceBundle. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg0)
Retrieves the string identified by the supplied key from this I18nUtil's ResourceBundle with the supplied values substituted in. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object[] args)
Retrieves the string identified by the supplied key from this I18nUtil's ResourceBundle with the supplied values substituted in. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1)
Retrieves the string identified by the supplied key from this I18nUtil's ResourceBundle with the supplied values substituted in. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2)
Retrieves the string identified by the supplied key from this I18nUtil's ResourceBundle with the supplied values substituted in. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Retrieves the string identified by the supplied key from this I18nUtil's ResourceBundle with the supplied values substituted in. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
Retrieves the string identified by the supplied key from this I18nUtil's ResourceBundle with the supplied values substituted in. |
void |
setBundleName(java.lang.String bundleName)
Sets the name of the ResourceBundle that this I18nUtil object should use. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the ClassLoader that this I18nUtil object will use to retrieve resources. |
void |
setLocale(java.util.Locale locale)
Sets the locale that this I18nUtil object should use. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_RESOURCE_BUNDLE_NAME
| Constructor Detail |
|---|
public I18nUtil(java.lang.Class clazz)
clazz - the class whose package should be used
to retrieve the ResourceBundle.
public I18nUtil(java.lang.Class clazz,
java.lang.ClassLoader classLoader)
clazz - the class whose package should be used
to retrieve the ResourceBundle.classLoader - the ClassLoader to use when retrieving
the ResourceBundle.
public I18nUtil(java.lang.Class clazz,
java.lang.String resourceBundleName)
clazz - the class whose package should be used
to retrieve the ResourceBundle.resourceBundleName - the name of the ResourceBundle to look
for within the supplied class's package.public I18nUtil(java.lang.Package pkg)
pkg - the package from which the
ResourceBundle should be retrieved.
public I18nUtil(java.lang.Package pkg,
java.lang.String resourceBundleName)
pkg - the package from which the
ResourceBundle should be retrieved.resourceBundleName - the name of the ResourceBundle to
look for within the supplied package.public I18nUtil(java.lang.String bundleName)
bundleName - the name of the ResourceBundle that the
I18nUtil should work with.
public I18nUtil(java.lang.String bundleName,
java.lang.ClassLoader classLoader)
bundleName - the name of the ResourceBundle that the
I18nUtil should work with.classLoader - the ClassLoader to use when retrieving
the ResourceBundle.
public I18nUtil(java.lang.String bundleName,
java.util.Locale locale)
bundleName - the name of the ResourceBundle that the
I18nUtil should work with.locale - the locale that the I18nUtil should
use when retrieving resources from the
ResourceBundle.| Method Detail |
|---|
public java.lang.ClassLoader getClassLoader()
public void setClassLoader(java.lang.ClassLoader classLoader)
public java.util.Locale getLocale()
public void setLocale(java.util.Locale locale)
locale - The locale for this I18nUtil to use when
retrieving resources.public java.lang.String getBundleName()
public void setBundleName(java.lang.String bundleName)
bundleName - The name of the ResourceBundle that this
I18nUtil object should use.public java.lang.String getString(java.lang.String key)
key - The key into the ResourceBundle for the
desired String.
public java.lang.String getString(java.lang.String key,
java.lang.Object arg0)
key - The key into the ResourceBundle for the
desired String.arg0 - The replacement value to substitute into
position 0
public java.lang.String getString(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1)
key - The key into the ResourceBundle for the
desired String.arg0 - The replacement value to substitute into
position 0arg1 - The replacement value to substitute into
position 1
public java.lang.String getString(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2)
key - The key into the ResourceBundle for the
desired String.arg0 - The replacement value to substitute into
position 0arg1 - The replacement value to substitute into
position 1arg2 - The replacement value to substitute into
position 2
public java.lang.String getString(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
key - The key into the ResourceBundle for the
desired String.arg0 - The replacement value to substitute into
position 0arg1 - The replacement value to substitute into
position 1arg2 - The replacement value to substitute into
position 1arg3 - The replacement value to substitute into
position 3
public java.lang.String getString(java.lang.String key,
java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
key - The key into the ResourceBundle for the
desired String.arg0 - The replacement value to substitute into
position 0arg1 - The replacement value to substitute into
position 1arg2 - The replacement value to substitute into
position 1arg3 - The replacement value to substitute into
position 3arg4 - The replacement value to substitute into
position 4
public java.lang.String getString(java.lang.String key,
java.lang.Object[] args)
key - The key into the ResourceBundle for the
desired String.args - The replacement values to substitute into
the String retrieved from the
ResourceBundle.
public java.lang.Object[] buildObjectArray(java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2)
arg0 - The object that is to be put into an
Object array at index 0.arg1 - The object that is to be put into an
Object array at index 1.arg2 - The object that is to be put into an
Object array at index 2.
public java.lang.Object[] buildObjectArray(java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
arg0 - The object that is to be put into an
Object array at index 0.arg1 - The object that is to be put into an
Object array at index 1.arg2 - The object that is to be put into an
Object array at index 2.arg3 - The object that is to be put into an
Object array at index 3.
public java.lang.Object[] buildObjectArray(java.lang.Object arg0,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
arg0 - The object that is to be put into an
Object array at index 0.arg1 - The object that is to be put into an
Object array at index 1.arg2 - The object that is to be put into an
Object array at index 2.arg3 - The object that is to be put into an
Object array at index 3.arg4 - The object that is to be put into an
Object array at index 4.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||