Package sonia.scm.i18n
Class I18nMessages
java.lang.Object
sonia.scm.i18n.I18nMessages
The I18nMessages class instantiates a class and initializes all
String
fields with values from a resource bundle. The resource bundle must have the
same name as the class. Each field which should be initialized from the
bundle, must match a key in the resource bundle or is annotated with a
I18n annotation which holds the key. I18nMessages injects also the
locale and the bundle if it founds a field with the corresponding type.- Since:
- 1.37
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TSame asget(java.lang.Class, java.util.Locale), with localeLocale.ENGLISH.static <T> TSame asget(java.lang.Class, java.util.Locale), with locale from servlet request (ServletRequest.getLocale()).static <T> TReturns an instance of the given message class with all message fields initialized.
-
Method Details
-
get
Same asget(java.lang.Class, java.util.Locale), with localeLocale.ENGLISH.- Type Parameters:
T- type of message class- Parameters:
msgClass- message class- Returns:
- instance of message class
-
get
Same asget(java.lang.Class, java.util.Locale), with locale from servlet request (ServletRequest.getLocale()).- Type Parameters:
T- type of message class- Parameters:
msgClass- message classrequest- servlet request
-
get
Returns an instance of the given message class with all message fields initialized.- Type Parameters:
T- type of the message class- Parameters:
msgClass- message classlocale- locale
-