|
|||||||||
| Home >> All >> org >> apache >> tomcat >> util >> [ res overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.tomcat.util.res
Class StringManager

java.lang.Objectorg.apache.tomcat.util.res.StringManager
- public class StringManager
- extends java.lang.Object
An internationalization / localization helper class which reduces the bother of handling ResourceBundles and takes care of the common cases of message formating which otherwise require the creation of Object arrays and such.
The StringManager operates on a package basis. One StringManager per package can be created and accessed via the getManager method call.
The StringManager will look for a ResourceBundle named by the package name given plus the suffix of "LocalStrings". In practice, this means that the localized information will be contained in a LocalStrings.properties file located in the package directory of the classpath.
Please see the documentation for java.util.ResourceBundle for more information.
- Version:
- $Revision: 299753 $ $Date: 2004-08-29 13:14:42 -0400 (Sun, 29 Aug 2004) $
| Field Summary | |
private java.util.ResourceBundle |
bundle
The ResourceBundle for this StringManager. |
private java.util.Locale |
locale
|
private static java.util.Hashtable |
managers
|
| Constructor Summary | |
private |
StringManager(java.util.ResourceBundle bundle)
|
private |
StringManager(java.lang.String packageName)
Creates a new StringManager for a given package. |
private |
StringManager(java.lang.String packageName,
java.util.Locale loc)
|
| Method Summary | |
static StringManager |
getManager(java.util.ResourceBundle bundle)
Get the StringManager for a particular package. |
static StringManager |
getManager(java.lang.String packageName)
Get the StringManager for a particular package. |
static StringManager |
getManager(java.lang.String packageName,
java.util.Locale loc)
Get the StringManager for a particular package and Locale. |
java.lang.String |
getString(java.lang.String key)
Get a string from the underlying resource bundle or return null if the String is not found. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg)
Get a string from the underlying resource bundle and format it with the given object argument. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object[] args)
Get a string from the underlying resource bundle and format it with the given set of arguments. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2)
Get a string from the underlying resource bundle and format it with the given object arguments. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Get a string from the underlying resource bundle and format it with the given object arguments. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
Get a string from the underlying resource bundle and format it with the given object arguments. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
bundle
private java.util.ResourceBundle bundle
- The ResourceBundle for this StringManager.
locale
private java.util.Locale locale
managers
private static java.util.Hashtable managers
| Constructor Detail |
StringManager
private StringManager(java.lang.String packageName)
- Creates a new StringManager for a given package. This is a
private method and all access to it is arbitrated by the
static getManager method call so that only one StringManager
per package will be created.
StringManager
private StringManager(java.lang.String packageName, java.util.Locale loc)
StringManager
private StringManager(java.util.ResourceBundle bundle)
| Method Detail |
getString
public java.lang.String getString(java.lang.String key)
- Get a string from the underlying resource bundle or return
null if the String is not found.
getString
public java.lang.String getString(java.lang.String key, java.lang.Object[] args)
- Get a string from the underlying resource bundle and format
it with the given set of arguments.
getString
public java.lang.String getString(java.lang.String key, java.lang.Object arg)
- Get a string from the underlying resource bundle and format it
with the given object argument. This argument can of course be
a String object.
getString
public java.lang.String getString(java.lang.String key, java.lang.Object arg1, java.lang.Object arg2)
- Get a string from the underlying resource bundle and format it
with the given object arguments. These arguments can of course
be String objects.
getString
public java.lang.String getString(java.lang.String key, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
- Get a string from the underlying resource bundle and format it
with the given object arguments. These arguments can of course
be String objects.
getString
public java.lang.String getString(java.lang.String key, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
- Get a string from the underlying resource bundle and format it
with the given object arguments. These arguments can of course
be String objects.
getManager
public static StringManager getManager(java.lang.String packageName)
- Get the StringManager for a particular package. If a manager for
a package already exists, it will be reused, else a new
StringManager will be created and returned.
getManager
public static StringManager getManager(java.util.ResourceBundle bundle)
- Get the StringManager for a particular package. If a manager for
a package already exists, it will be reused, else a new
StringManager will be created and returned.
getManager
public static StringManager getManager(java.lang.String packageName, java.util.Locale loc)
- Get the StringManager for a particular package and Locale. If a manager for
a package already exists, it will be reused, else a new
StringManager will be created for that Locale and returned.
|
|||||||||
| Home >> All >> org >> apache >> tomcat >> util >> [ res overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.tomcat.util.res.StringManager