com.ibm.as400.opnav
Class ResourceLoader

java.lang.Object
  |
  +--com.ibm.as400.opnav.ResourceLoader

public class ResourceLoader
extends java.lang.Object

A utility class which wrappers ResourceBundle operations and handles exceptions gracefully. For example, if a string resource cannot be accessed, ResourceLoader returns the string "RESOURCEMISSING", allowing the developer to quickly detect the missing resource and correct the problem.

Since:
v3r2m1

Constructor Summary
ResourceLoader()
          Constructs a ResourceLoader object.
 
Method Summary
 java.lang.String format(java.lang.String key)
          Returns a formatted string.
 java.lang.String format(java.lang.String key, java.lang.Object[] args)
          Returns a formatted string.
 java.lang.String getString(java.lang.String key)
          Returns a locale-dependent string.
 void setResourceName(java.lang.String name)
          Sets the resource bundle name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceLoader

public ResourceLoader()
Constructs a ResourceLoader object.
Since:
v4r2m0
Method Detail

setResourceName

public void setResourceName(java.lang.String name)
Sets the resource bundle name. setResourceName attempts to load the specified resource bundle. If an error occurs, an exception is logged and appropriate action is taken on subsequent requests for specific resources.
Parameters:
name - the name of the resource bundle to be loaded. If the resource bundle could not be found, getString will return the string "RESOURCEBUNDLEERROR".
Since:
v4r2m0

getString

public java.lang.String getString(java.lang.String key)
Returns a locale-dependent string. getString looks for the string resource identified by the specified key in the resource bundle specified on setResourceName. If the string could not be found, getString returns "RESOURCEMISSING". If the resource bundle could not be loaded, getString returns "RESOURCEBUNDLEERROR".
Parameters:
key - the key which identifies the string to be loaded.
Returns:
the locale-dependent string.
Since:
v4r2m0

format

public final java.lang.String format(java.lang.String key)
Returns a formatted string.
Parameters:
key - the key which identifies the string to be loaded.
Returns:
a formatted string.
Since:
v4r5m0

format

public final java.lang.String format(java.lang.String key,
                                     java.lang.Object[] args)
Returns a formatted string.
Parameters:
key - the key which identifies the string to be loaded.
args - the objects to be substituted into the format string.
Returns:
a formatted string.
Since:
v4r5m0