Class CCMessageUtilities

java.lang.Object
com.ibm.debug.pdt.codecoverage.core.results.CCMessageUtilities
All Implemented Interfaces:
CCNLConstants

public class CCMessageUtilities extends Object implements CCNLConstants
Utility methods to obtain message text from API messages
Since:
3.1
  • Constructor Details

    • CCMessageUtilities

      public CCMessageUtilities()
  • Method Details

    • setLanguage

      public static void setLanguage(int language)
      Set the default language see CCNLConstants for list
      Parameters:
      language - language id as defined in CCNLConstants
    • setLanguage

      public static void setLanguage(Locale locale)
      Set the default language using locale
      Parameters:
      locale - locale for label text
      Since:
      5.0
    • getMessage

      public static String getMessage(String messageKey, String[] parms)
      Retrieves the full message based on key and parameters
      Parameters:
      messageKey - the message key
      parms - the list of parameters
      Returns:
      the message with substitutions
    • getMessage

      public static String getMessage(String messageKey, String[] parms, int language)
      Retrieves the full message based on the key and parameters for the given language
      Parameters:
      messageKey - message key or id
      parms - substitution values
      language - language id as defined in CCNLConstants
      Returns:
      full message text
      Since:
      5.0
    • getMessage

      public static String getMessage(String messageKey, String[] parms, Locale locale)
      Retrieves the full message based on the key and parameters for the given language
      Parameters:
      messageKey - message key or id
      parms - substitution values
      locale - locale for message text
      Returns:
      full message text
      Since:
      5.0
    • getMessage

      public static String getMessage(String encodedMessage)
      Retrieve the full message text with substitutions executed Will return the message if it is a plain text (non-encoded) message
      Parameters:
      encodedMessage - the message key and parameter string combination or just the message key
      Returns:
      full message in the default language
      Since:
      4.0
    • getMessage

      public static String getMessage(String encodedMessage, int language)
      Retrieve the full message text with substitutions executed Will return the message if it is a plain text (non-encoded) message
      Parameters:
      encodedMessage - the message key and parameter string combination or just the message key
      language - language id as defined in CCNLConstants
      Returns:
      the full message text
      Since:
      5.0
    • getMessage

      public static String getMessage(String encodedMessage, Locale locale)
      Retrieve the full message text with substitutions executed Will return the message if it is a plain text (non-encoded) message
      Parameters:
      encodedMessage - the message key and parameter string combination or just the message key
      locale - locale for message text
      Returns:
      the full message text
      Since:
      5.0
    • getMessageId

      public static String getMessageId(String encodedMessage)
      Return the message id or key from the encoded message
      Parameters:
      encodedMessage - the message key and parm string combination or just the message key
      Returns:
      message id or key or "" if passed message is invalid
    • getErrorLevel

      public static char getErrorLevel(String encodedMessage)
      Retrieves the error level of the message Results may be inconsistent if a plain text messages is passed
      Parameters:
      encodedMessage - the message and parameter string combination
      Returns:
      the error level
    • encodeMessage

      public static String encodeMessage(String messageKey, String[] parms)
      Given a message key and an array of zero or more parameters an encoded string is returned that can be stored into the objects that inherit ICCBase and extend CCAbstractException This format has the advantage that is does not contain translatable text. Some classes like CCAbstractException have helper methods that don't require an array
      Parameters:
      messageKey - message key or id
      parms - substitution values
      Returns:
      encoded message string
      Since:
      4.0
    • encodeMessage

      public static String encodeMessage(String messageKey, String[] parms, int language)
      This method will accept a message key + parms or it will accept a string that represents a complete message if an empty or null parm is passed
      Parameters:
      messageKey - message key or id
      parms - substitution values
      language - language as defined in CCNLConstants
      Returns:
      encoded message
      Since:
      5.0
    • encodeMessage

      public static String encodeMessage(String messageKey, String[] parms, Locale locale)
      This method will accept a message key + parms or it will accept a string that represents a complete message if an empty or null parm is passed
      Parameters:
      messageKey - message key or id
      parms - substitution values
      locale - local for message text
      Returns:
      encoded message
      Since:
      5.0