|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Interface identifying instances capable of being localized
using a ScarabLocalizationTool instance.
In order to localize throwables, one could reuse the following pattern:
public class MyLocalizedThrowable extends MyThrowableClass implements Localizable
{
// may be null
private ScarabLocalizationTool localizer;
// Set the localizer to be used in later calls to
This should be particularly thought when one subclasses instances from a
different framework, because that framework may be or may become localized
one day.
#getLocalizedMessage()
// @param theLocalizer the localizer (may be null)
public void setLocalizer(final ScarabLocalizationTool theLocalizer)
{
localizer = theLocalizer;
}
// Return the localized message for that throwable, if a localizer
// was defined using #setLocalizer(ScarabLocalizationTool)
// @return the localized message.
public String getLocalizedMessage()
{
// we effectively implement an IoC pattern, made necessary by
// the design of the Throwable base class
if (localizer != null)
{
return toString(localizer);
}
else
{
return super.getLocalizedMessage();
}
}
}
| Method Summary | |
java.lang.String |
getMessage()
resolve the instance to the ScarabLocalizationTool.DEFAULT_LOCALE Note: This method should return english messages independent of any l10n settings. |
java.lang.String |
getMessage(ScarabLocalizationTool l10n)
resolve the message according to the parameters of the given ScarabLocalizationTool instance. |
| Method Detail |
public java.lang.String getMessage()
resolve(ScarabLocalizationTool) instead.
public java.lang.String getMessage(ScarabLocalizationTool l10n)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||