| java.lang.Object java.util.ResourceBundle com.ice.util.FormatResourceBundle
Constructor Summary | |
public | FormatResourceBundle(ResourceBundle bundle) Construct a new FormatResourceBundle by encapsulating another
ResourceBundle object which is the actual bundle. |
FormatResourceBundle | public FormatResourceBundle(ResourceBundle bundle)(Code) | | Construct a new FormatResourceBundle by encapsulating another
ResourceBundle object which is the actual bundle.
Parameters: bundle - The resource bundle that we are encapsulating. |
addAlias | public static void addAlias(String alias, String baseName)(Code) | | Add a resource name alias. This allows you to use shorter
names for your resource bundles. For example:
FormatResourceBundle.addAlias( "ui", "com.ice.mail.resources.ui" );
...
FormatResourceBundle fmtBndl =
FormatResourceBundle.getFormatBundle( "ui" );
...
FormatResourceBundle.getFormatBundle( "ui" ).getString( "menuName" );
The alias will only work with the getFormatBundle() class methods
in this class, and will not work with the other ResourceBundle
getBundle() class methods.
Parameters: alias - The alias by which you will refer to this resource bundle. Parameters: baseName - The actual resource name used to get the bundle. |
getFormatBundle | public static FormatResourceBundle getFormatBundle(String baseName)(Code) | | Get a FormatResourceBundle. This method actually calls
ResourceBundle.getBundle(). However, first, the method
substitutes any aliases added by the programmer, and
second, the method wraps the retrieved ResourceBundle
within a FormatResourceBundle adding the getFormatString()
method to those already provided by ResourceBundle().
Parameters: baseName - The name, or alias, of the bundle to get. The cached or a new FormatResource. |
getFormatBundle | public static FormatResourceBundle getFormatBundle(String baseName, Locale locale)(Code) | | Get a FormatResourceBundle. This method is identical to
getFormatBundle( String baseName ), except that it takes
an additional locale parameter.
Parameters: baseName - The name, or alias, of the bundle to get. Parameters: locale - The locale to use in locating the bundle. The cached or a new FormatResource. |
getFormatString | public String getFormatString(String key, Object[] args)(Code) | | Get a string from the resource bundle, and return the formatted
version of the string using args. This method gets the resource
string identified by key, then passes the string to the
MessageFormat.format() as the format string, and passes args
as the format arguments.
Parameters: key - The key of the string resource to format. Parameters: args - The arguments to use to format the string. The formatted string. |
getKeys | public Enumeration getKeys()(Code) | | Return an enumeration of the resource keys. This method simply
calls the same method of the resource bundle we are encapsulating.
An enumeration of the resource keys. |
getString | public String getString(String key, String defValue)(Code) | | This method simply extends the ResourceBundle's getString()
with a method that allows a default value to be specified.
Parameters: key - The key of the string resource to format. Parameters: defValue - The default value used if key not found. The resource string. |
handleGetObject | protected Object handleGetObject(String key)(Code) | | Return an object identified by its key. This method simply
calls the same method of the resource bundle we are encapsulating.
Parameters: key - The key of the object to return. The object identified by the key. |
unCache | public static void unCache(String alias, String baseName)(Code) | | This class method allows you to remove a bundle from the cache.
This allows the bundle to be GC-ed.
Parameters: baseName - The resource bundle's name or alias. |
|
|