multex
Class MsgText

java.lang.Object
  |
  +--multex.MsgText

public class MsgText
extends java.lang.Object

Services for getting the message text for exceptions. It handles exceptions

For normal message reporting you should use the services of one of the destination oriented reporting classes, e.g. Msg or Awt.


Field Summary
static java.lang.String causeMarker
           
static java.lang.String resourceBundleName
           
 
Method Summary
static void appendMessageChain(java.lang.StringBuffer io_destination, java.lang.Throwable i_throwable, java.lang.String i_lineSeparator)
          Deprecated. since MulTEx 4 (2003-05-27). Use the more parameterized version instead.
static void appendMessageLine(java.lang.StringBuffer io_destination, java.lang.Throwable i_throwable)
          Appends the usually one-line message text for the exception i_throwable with inserted parameters to io_buffer.
static void appendMessageLine(java.lang.StringBuffer io_destination, java.lang.Throwable i_throwable, MultexLocale i_locale)
          Appends the usually one-line message text for the exception i_throwable with inserted parameters to io_buffer, localizable.
static MultexLocale getLocale()
          Returns the actual MultexLocale used for static or no internationalization.
static void setInternationalization(boolean i_internationalization)
          If true, Activates the static default internationalization of message texts.
static void setInternationalization(MultexLocale i_locale)
          Activates a specific static internationalization of message texts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourceBundleName

public static final java.lang.String resourceBundleName
See Also:
Constant Field Values

causeMarker

public static final java.lang.String causeMarker
See Also:
Constant Field Values
Method Detail

setInternationalization

public static void setInternationalization(boolean i_internationalization)
If true, Activates the static default internationalization of message texts. Further calls to appendMessageLine(java.lang.StringBuffer, java.lang.Throwable) or appendMessageChain(java.lang.StringBuffer, java.lang.Throwable, java.lang.String) will deliver the localized message text for an exception instead of the default message text contained in the MultexException-object. The localized message text will be taken from the resource bundle with the name resourceBundleName. If false, deactivates static internationalization. The Message text for a MultexException will be taken directly from the exception object itself.

Since:
MulTEx 1c

setInternationalization

public static void setInternationalization(MultexLocale i_locale)
                                    throws java.lang.IllegalArgumentException
Activates a specific static internationalization of message texts. Further calls to appendMessageLine(java.lang.StringBuffer, java.lang.Throwable) or appendMessageChain(java.lang.StringBuffer, java.lang.Throwable, java.lang.String) will deliver the localized message text for an exception instead of the default message text contained in the MultexException-object.

Parameters:
i_locale - How to localize exception message texts
Throws:
java.lang.IllegalArgumentException - If null is provided as i_locale
Since:
MulTEx 4
See Also:
setInternationalization(boolean)

getLocale

public static MultexLocale getLocale()
Returns the actual MultexLocale used for static or no internationalization.


appendMessageChain

public static void appendMessageChain(java.lang.StringBuffer io_destination,
                                      java.lang.Throwable i_throwable,
                                      java.lang.String i_lineSeparator)
Deprecated. since MulTEx 4 (2003-05-27). Use the more parameterized version instead.

Appends the message for i_throwable with its causal chain. Appends an usually multi-line message, in which the first line is the message for i_throwable and the further lines are the messages in the chain of causing exceptions of i_throwable. See appendMessageLine(java.lang.StringBuffer, java.lang.Throwable) for a despription, how each exception is transformed into a message line.

Parameters:
i_lineSeparator - The String used to separate the lines of the message chain. If null is provided, defaults to Failure.lineSeparator.

appendMessageLine

public static void appendMessageLine(java.lang.StringBuffer io_destination,
                                     java.lang.Throwable i_throwable)
Appends the usually one-line message text for the exception i_throwable with inserted parameters to io_buffer. The message text pattern for the exception is taken from the mostly localized variant of the properties file "MsgText.properties" or helpwise from the default message text pattern in the exception object itself. A local message text pattern for the german language (de) in its swiss (CH) variant would be taken from file "MsgText_de_CH.properties", see the Java Tutorial chapter on internationalization at february 1999.

This file must contain definition lines of the form:

      packageName.ExceptionName = message text pattern
   
or
      packageName.ClassName$InnerExceptionName = message text pattern
   
with parameter substitutors in the message text pattern, e.g.:
      CopyNP$CopyFailure = The file "{0}" could not be copied to "{1}"
   


appendMessageLine

public static void appendMessageLine(java.lang.StringBuffer io_destination,
                                     java.lang.Throwable i_throwable,
                                     MultexLocale i_locale)
Appends the usually one-line message text for the exception i_throwable with inserted parameters to io_buffer, localizable. Note: You usually should pass only a ResourceBundle to i_messages, which was loaded with the same Locale, which you pass to i_locale.

Parameters:
i_locale - Source for the message text patterns instead of the default, the text pattern is taken with the class name of i_throwable as key from i_locale.getMessages(). Controls the formatting of the message parameters, too.
See Also:
for details of parameter substitution