public class GlobalMessages extends AbstractMessageHandler
Modifier and Type | Field and Description |
---|---|
protected static String |
BUNDLE_NAME |
protected static GlobalMessages |
GMinstance |
protected static LanguageChoice |
langChoice |
static String[] |
localeCodes |
static String[] |
localeDescr |
protected static Map<String,ResourceBundle> |
locales |
protected static LogChannelInterface |
log |
protected static String |
SYSTEM_BUNDLE_PACKAGE |
protected static ThreadLocal<Locale> |
threadLocales |
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 |
---|---|
protected static String |
buildBundleName(String packageName) |
protected static String |
buildHashKey(Locale locale,
String packageName) |
protected String |
calculateString(String packageName,
String key,
Object[] parameters) |
protected String |
calculateString(String packageName,
String key,
Object[] parameters,
Class<?> resourceClass) |
protected String |
findString(String packageName,
Locale locale,
String key,
Object[] parameters) |
protected String |
findString(String packageName,
Locale locale,
String key,
Object[] parameters,
Class<?> resourceClass) |
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() |
protected static Map<String,ResourceBundle> |
getLocales() |
protected static String |
getLocaleString(Locale locale) |
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) |
protected static final ThreadLocal<Locale> threadLocales
protected static final LanguageChoice langChoice
protected static final String SYSTEM_BUNDLE_PACKAGE
protected static final String BUNDLE_NAME
protected static final Map<String,ResourceBundle> locales
protected static final LogChannelInterface log
public static final String[] localeCodes
public static final String[] localeDescr
protected static GlobalMessages GMinstance
public GlobalMessages()
public static MessageHandler getInstance()
protected static Map<String,ResourceBundle> getLocales()
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
protected String findString(String packageName, Locale locale, String key, Object[] parameters) throws MissingResourceException
MissingResourceException
protected String findString(String packageName, Locale locale, String key, Object[] parameters, Class<?> resourceClass) throws MissingResourceException
MissingResourceException
protected String calculateString(String packageName, String key, Object[] parameters)
protected String calculateString(String packageName, String key, Object[] parameters, Class<?> resourceClass)
public String getString(String key)
MessageHandler
public String getString(String packageName, String key)
MessageHandler
public String getString(String packageName, String key, String... parameters)
MessageHandler
Copyright © 2018 Hitachi Vantara. All rights reserved.