| java.lang.Object com.ice.util.ResourceManager
ResourceManager | public class ResourceManager (Code) | | This class attempts to manage a set of ResourceBundles. For example,
an application may have one set of resources for the GUI elements in
the application, and another set of resources for context help, and
yet another set for builtin scripts.
Each ResourceManager instance is identified by an id. Class methods
provided to allow quick access to any ResourceManager by id.
ResourceManager, aside from manager multiple instances by id, also
add an additional method beyond that provided by ResourceBundle -
getFormat(). This method is like getString() in that is returns a
String resource, however, getFormat() formats the resource using
arguments passed to the method. This makes it easy to use resources
for both constant strings and formatted strings.
version: $Revision: 1.1 $ author: Timothy Gerard Endres, author: time@ice.com. |
Method Summary | |
public static ResourceManager | get(String id) Get a ResourceManager keyed by id.
Parameters: id - The id of the ResourceManager to be returned. | public String | getFormat(String key, Object[] args) Format a string resource from the ResourceBundle that this
ResourceManager is managing. | public String | getString(String key) Get a string resource from the ResourceBundle that this
ResourceManager is managing.
Parameters: key - The key of the resource to retrieve. | public static void | initialize() Initializes the class by instantiating the bundles Hashtable. | public static void | load(String id, String name) Load a PropertyResourceBundle using the name, and add it to the
bundles Hashtable keyed by id.
Parameters: id - The id of the ResourceManager. | public static ResourceManager | put(String id, ResourceManager rMgr) Put a ResourceManager into the bundles Hashtable, keyed by id.
Parameters: id - The id used to identify this ResourceManager. Parameters: rMgr - The resource manager to be managed. | public void | setDebug(boolean debug) Set the debugging flag for this ResourceManager. |
ResourceManager | public ResourceManager(String name, ResourceBundle rsrc) throws MissingResourceException(Code) | | Construct a ResourceManager with the given name and ResourceBundle.
Parameters: name - The (display) name of this resource bundle. Parameters: rsrc - The resource bundle to be managed. |
get | public static ResourceManager get(String id)(Code) | | Get a ResourceManager keyed by id.
Parameters: id - The id of the ResourceManager to be returned. The ResourceManager identied by id. |
getFormat | public String getFormat(String key, Object[] args)(Code) | | Format a string resource from the ResourceBundle that this
ResourceManager is managing. The key is used to retrieve a
resource that is the format, which is then formatted using
the provided arguments.
Parameters: key - The key of the resource that is the message format. Parameters: args - The arguments to be used to format the message. The formatted resource message. |
getString | public String getString(String key)(Code) | | Get a string resource from the ResourceBundle that this
ResourceManager is managing.
Parameters: key - The key of the resource to retrieve. The resource string. |
initialize | public static void initialize()(Code) | | Initializes the class by instantiating the bundles Hashtable.
Your application must call this class method only once, and
before calling any other methods in this class.
|
load | public static void load(String id, String name)(Code) | | Load a PropertyResourceBundle using the name, and add it to the
bundles Hashtable keyed by id.
Parameters: id - The id of the ResourceManager. This is used as thekey into the bundles table. Parameters: name - The name of the ResourceManager. This is used toload the resource bundle. |
put | public static ResourceManager put(String id, ResourceManager rMgr)(Code) | | Put a ResourceManager into the bundles Hashtable, keyed by id.
Parameters: id - The id used to identify this ResourceManager. Parameters: rMgr - The resource manager to be managed. The previous ResourceManager identied by id, or null. |
setDebug | public void setDebug(boolean debug)(Code) | | Set the debugging flag for this ResourceManager. If debugging is
set to true, debugging will be printed to System.err.
Parameters: debug - The new debugging setting. |
|
|