The most comfortable way to get an internationalizable message text pattern associated with each exception is the following, usable from MulTEx version 7.1.
You define the message text pattern for each concrete subclass of Throwable of which you have the source code. You place the text pattern as the main comment into the Javadoc comment of the exception class before any @tags. So the text pattern serves both as documentation for this exception, and as text pattern for internationalization.
For example you could define an exception
CreditLimitExc
with a message text pattern,
expecting two message parameters, as follows.
package org.company.project; class Account { ... /**Taking {0} units from your ac * count will leave less than your credit limit {1} units on it. */ public static final class CreditLimitExc extends multex.Exc {} }
For Failure
s there is no difference. You
only have to declare the exception as a subclass of
multex.Failure
. For example in class
org.company.project.FileUtil
:
/**Failure loading file {0} by user {1}*/ public static final class LoadFileFailure extends multex.Failure {}
These exception declarations are so simple, as all diagnostic
information (causes and parameters) are stored in the MulTEx base class,
Exc
, or Failure
,
respectively. For ease of use they should be initialized using the
generic create
method in the
MultexUtil
class, rather than the
init
-methods. So the concrete exception class
merely serves with its class name as a key to a message text resource
bundle.