getMessage()

Retrieve a message from the collaboration message file.

Syntax

public String getMessage(int messageNum)
 public String getMessage(int messageNum, Object[] paramArray)
 

Parameters

messageNum
The message number of a message in the collaboration's message file, which is indexed by message number. For information on how to set up a message text file, refer to Creating a message file.

paramArray
An array of message-parameter values. Each is sequentially resolved to a parameter in the message text. Within the message (in the collaboration message file), message parameters are indicated by integers enclosed by braces; for example, {1}.

Return values

A String object that contains the message text for the message identified by messageNum.

Notes

The getMessage() method provides two forms:

For more information on message files and message parameters, see Creating a message file.

Examples

Suppose your collaboration message file defines the following two messages with message numbers of 8 and 9:

8
 Error occurred during JDBC URL conversion. Reason:{1}
 [EXPL]
 An error, indicated by the reason, occurred during the 
 conversion of a JDBC URL string.
 9
 Invalid login encountered in command-line arguments. A valid 
 login must contain a login name and a password.
 [EXPL]
 A password has been specified but a user name has not. If no 
 login name is specified, the default login name "crossworlds" is assumed.
 

The following call to getMessage() obtains the text associated with message 9:

String invalidLogin = getMessage(9);
 

The following call to getMessage() obtains the text associated with message 8 and includes a value for the message's Reason parameter:

String reason = "Invalid database table."; 
 Object[] paramList = new Object[1];
 paramList[0] = reason;
 badConversion = getMessage(8, paramList);
 

The message obtained from the previous getMessage() call would be:

Error occurred during JDBC URL conversion. Reason:Invalid database table.
 

Copyright IBM Corp. 2003, 2004