Package com.sun.enterprise.util.i18n
Class StringManager
- java.lang.Object
-
- com.sun.enterprise.util.i18n.StringManagerBase
-
- com.sun.enterprise.util.i18n.StringManager
-
public class StringManager extends StringManagerBase
Implementation of a local string manager. Provides access to i18n messages for classes that need them.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". This means that localized information will be contained in a LocalStrings.properties file located in the package directory of the classpath.
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 - Since:
- JDK1.4
- Author:
- Nazrul Islam
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringManager
getManager(Class callerClass)
Returns a local string manager for the given package name.static StringManager
getManager(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 Detail
-
getManager
public static StringManager getManager(String packageName, ClassLoader classLoader)
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
public static StringManager getManager(Class callerClass)
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
-
-