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.
java.util.ResourceBundle
| Modifier and Type | Field and Description |
|---|---|
| private final ResourceBundle | bundle
The ResourceBundle for this StringManager. |
| private final Locale | |
| private static final Map |
| Access | Constructor and Description |
|---|---|
| private | StringManager(String
Name of package to create StringManager for. packageName)Creates a new StringManager for a given package. |
| Modifier and Type | Method and Description |
|---|---|
| public static final synchronized StringManager | Returns: The instance associated with the given packageThe package name packageName)Get the StringManager for a particular package. |
| public static final StringManager | |
| public String | |
| public String | Returns: The request string formatted with the provided arguments or the key if the key was not found.The key for the required message key, final Object... The values to insert into the message args)Get a string from the underlying resource bundle and format it with the given set of arguments. |
| bundle | back to summary |
|---|---|
| private final ResourceBundle bundle The ResourceBundle for this StringManager. | |
| locale | back to summary |
|---|---|
| private final Locale locale | |
| managers | back to summary |
|---|---|
| private static final Map<String, StringManager> managers | |
| StringManager | back to summary |
|---|---|
| private StringManager(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.
| |
| getManager | back to summary |
|---|---|
| public static final synchronized StringManager getManager(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 | back to summary |
|---|---|
| public static final StringManager getManager(Class<?> clazz) | |
| getString | back to summary |
|---|---|
| public String getString(String key) Get a string from the underlying resource bundle or return null if the String is not found.
| |
| getString | back to summary |
|---|---|
| public String getString(final String key, final Object... args) Get a string from the underlying resource bundle and format it with the given set of arguments. | |