KeyedMessage provides an automatically derived i18n message key based on its static instance definition and can be
used as comparable constant too.
Purpose
With a KeyedMessage a named constant message (format) can be statically defined which automatically translate
themselves for a specific locale using an automatically derived ResourceBundle or even a specified one.
Key derivation
Because KeyedMessages are created with a default message (format), even if no ResourceBundle or its key is defined or
can't be found, message translation is still possible.
A KeyedMessage automatically derives the ResourceBundle lookup key from its (statically defined) instance field name
using the following format:
<containingClass.name>.<staticInstanceField.name>
The containingClass is derived at construction time by analyzing the StackTraceElements of a thrown exception. |