com.ls.util
Class ResourceBasedErrorHandler
java.lang.Object
|
+--com.ls.util.ResourceBasedErrorHandler
- All Implemented Interfaces:
- IErrorHandler
- public class ResourceBasedErrorHandler
- extends Object
- implements IErrorHandler
Handle errors based on a resource bundle. All error messages are received from a resource bundle.
- Version:
- $Revision: 1.8 $
- Author:
- Last modified by $Author: TBerk $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourceBasedErrorHandler
public ResourceBasedErrorHandler()
- Constructor. Default empty constructor.
setResourceBundle
public void setResourceBundle(String bundleName)
throws ResourceBundleException
- Sets an error bundle.
It sets local value as
IErrorHandler.DEFAULT_LOCALE
.
- Parameters:
bundleName
- The name of the error bundle.- Throws:
ResourceBundleException
- If any error occurs while opening the error bundle
setResourceBundle
public void setResourceBundle(String bundleName,
String localeString)
throws ResourceBundleException
- Sets an error bundle.
- Parameters:
bundleName
- The name of the bundle which contains the error messageslocaleString
- The locale of the resource bundle that should be used- Throws:
ResourceBundleException
- If any error occurs while opening the error bundle
getErrorMessage
public String getErrorMessage(String key)
throws ResourceBundleException
- Returns a error message from the resourceBundle specified by the key
It uses
IErrorHandler.DEFAULT_LOCALE
as local value.
- Specified by:
getErrorMessage
in interface IErrorHandler
- Parameters:
key
- The key of the error message- Returns:
- The value (error message itself) which belongs to the given key.
- Throws:
ResourceBundleException
- If any error occurs while opening the error bundle
getErrorMessage
public String getErrorMessage(String key,
String localeString)
throws ResourceBundleException
- Returns a error message from the resourceBundle specified by the key
- Specified by:
getErrorMessage
in interface IErrorHandler
- Parameters:
key
- The key of the error messagelocaleString
- locale like "en_GB", "en_US" or "de_LU_EURO"...- Returns:
- The value (error message itself) which belongs to the given key.
- Throws:
ResourceBundleException
- If any error occurs while opening the error bundle