public class GlobalMessages extends AbstractMessageHandler
Modifier and Type | Field and Description |
---|---|
static String[] |
localeCodes |
static String[] |
localeDescr |
Constructor and Description |
---|
GlobalMessages()
TODO: extend from abstract class to ensure singleton status and migrate instantiation to class controlled private
|
Modifier and Type | Method and Description |
---|---|
static ResourceBundle |
getBundle(Locale locale,
String packageName) |
static ResourceBundle |
getBundle(Locale locale,
String packageName,
Class<?> resourceClass) |
static ResourceBundle |
getBundle(String packageName)
Retrieve a resource bundle of the default or fail-over locale.
|
static ResourceBundle |
getBundle(String packageName,
Class<?> resourceClass)
Retrieve a resource bundle of the default or fail-over locale.
|
static MessageHandler |
getInstance() |
static Locale |
getLocale() |
String |
getString(String key)
get a key from the default (System global) bundle
|
String |
getString(String packageName,
String key)
get a key from the defined package bundle, by key
|
String |
getString(String packageName,
String key,
Class<?> resourceClass,
String... parameters)
Get a string from the defined package bundle, by key and by a resource class
|
String |
getString(String packageName,
String key,
String... parameters)
get a key from the defined package bundle, by key
|
static void |
setLocale(Locale newLocale) |
public static final String[] localeCodes
public static final String[] localeDescr
public GlobalMessages()
public static MessageHandler getInstance()
public static Locale getLocale()
public static void setLocale(Locale newLocale)
public static ResourceBundle getBundle(String packageName) throws MissingResourceException
packageName
- The package to search inMissingResourceException
- in case both resource bundles couldn't be found.public static ResourceBundle getBundle(String packageName, Class<?> resourceClass) throws MissingResourceException
packageName
- The package to search inresourceClass
- the class to use to resolve the bundleMissingResourceException
- in case both resource bundles couldn't be found.public static ResourceBundle getBundle(Locale locale, String packageName) throws MissingResourceException
MissingResourceException
public static ResourceBundle getBundle(Locale locale, String packageName, Class<?> resourceClass) throws MissingResourceException
MissingResourceException
public String getString(String key)
MessageHandler
public String getString(String packageName, String key)
MessageHandler
public String getString(String packageName, String key, String... parameters)
MessageHandler