|
Oracle OLAP Java API Reference 10g Release 1 (10.1) B10994-01 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface for an Exception
that can provide its message in a language that is appropriate to a specified Locale
. This interface is implemented by Exception
classes that are generated by the OLAP API client software, not by those generated by the server-side software.
In order to find out if a given Exception
implements this interface, use the instanceof
operator.
Exception
implements this interface, then you can call its getLocalizedMessage
method specifying a particular Locale
as a parameter.Exception
does not implement this interface, then you can still call its getLocalizedMessage
method (which is inherited from the Throwable
class), but you do not specify a particular Locale
. In this case, the message is rendered in the language of the default Locale
for the Java Virtual Machine in which the OLAP API application is running.The following code illustrates the use of the getLocalizedMessage
method.
Locale mylocale = … // determine Locale to specify
try
{
// some code
}
catch ( Exception e )
{
String msg = null;
if ( e instanceof HasLocalizedMessage ) {
// get localized message
msg = ((HasLocalizedMessage) e).getLocalizedMessage(mylocale);
}
else {
// use the Locale for the connection
msg = e.getLocalizedMessage(); // note missing locale parameter
}
// handle message
}
Note that you do not have to use the getLocalizedMessage
method in order to obtain a message for an Exception
. The following code displays a message in the language of the default Locale
for the Java Virtual Machine in which the OLAP API application is running.
System.err.println(e.toString());
Method Summary | |
java.lang.String |
getLocalizedMessage(java.util.Locale locale) Gets a message in the language of the specified Locale . |
Method Detail |
public java.lang.String getLocalizedMessage(java.util.Locale locale)
Locale
. See the description of this interface for further information.locale
- A Locale
object, which indicates the language in which the message should be rendered.String
that contains the message for this Exception
. The message is in the language of the specified Locale
.
|
Oracle OLAP Java API Reference 10g Release 1 (10.1) B10994-01 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |