Package com.sun.enterprise.util.i18n
Class StringManager
java.lang.Object
com.sun.enterprise.util.i18n.StringManagerBase
com.sun.enterprise.util.i18n.StringManager
Implementation of a local string manager. Provides access to i18n messages
for classes that need them.
Example:
[LocalStrings.properties]
test=At {1,time} on {1,date}, there was {2} on planet {0,number,integer}
StringManager sm = StringManager.getManager(this);
.....
try {
....
} catch (Exception e) {
String localizedMsg = sm.getString("test",
new Integer(7), new java.util.Date(System.currentTimeMillis()),
"a disturbance in the Force");
throw new MyException(localizedMsg, e);
}
Localized message:
At 2:27:41 PM on Jul 8, 2002, there was a disturbance in the Force
on planet 7
One StringManager per package can be created and accessed by the getManager method call. The ResourceBundle name is constructed from the given package name in the constructor plus the suffix of "LocalStrings". Thie means that localized information will be contained in a LocalStrings.properties file located in the package directory of the classpath.
- Since:
- JDK1.4
- Author:
- Nazrul Islam
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringManagergetManager(Class callerClass) Returns a local string manager for the given package name.static StringManagergetManager(String packageName, ClassLoader classLoader) Returns a local string manager for the given package name.Methods inherited from class com.sun.enterprise.util.i18n.StringManagerBase
getString, getString, getString, getString, getString, getString, getStringManager, getStringWithDefault, getStringWithDefault
-
Method Details
-
getManager
Returns a local string manager for the given package name.- Parameters:
packageName- name of the package of the src- Returns:
- a local string manager for the given package name
-
getManager
Returns a local string manager for the given package name.- Parameters:
callerClass- the object making the call- Returns:
- a local string manager for the given package name
-