@Api public abstract class AbstractTranslator extends Object implements PackageTranslator, ClassLoaderTranslator
| Constructor and Description |
|---|
AbstractTranslator() |
AbstractTranslator(Translator parent) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTranslatedPackage(String packageName)
Adds package, that contains classes which should be translated with this translator.
|
boolean |
equals(Object obj) |
LocalizedString |
getLocalizedString(String key)
Creates LocalizedString with given key.
|
LocalizedString |
getLocalizedString(String key,
Locale locale)
Creates LocalizedString with given key and locale.
|
LocalizedString |
getLocalizedString(String key,
Locale locale,
Object... args)
Creates LocalizedString with given key, locale and message arguments.
|
LocalizedString |
getLocalizedString(String key,
Object... args)
Creates LocalizedString with given key and message arguments.
|
LocalizedString |
getLocalizedString(String key,
String defaultValue)
Creates LocalizedString with given key and default value.
|
LocalizedString |
getLocalizedString(String key,
String defaultValue,
Locale locale)
Creates LocalizedString with given key, locale and default value.
|
LocalizedString |
getLocalizedString(String key,
String defaultValue,
Locale locale,
Object... args)
Creates LocalizedString.
|
LocalizedString |
getLocalizedString(String key,
String defaultValue,
Object... args)
Creates LocalizedString with given key, default value and message arguments.
|
String |
getMessage(String key)
Return translated message for given key using current user locale.
|
String |
getMessage(String key,
Locale locale)
Return translated message for given key and locale.
|
String |
getMessage(String key,
Locale locale,
Object... args)
Return translated message for given key, locale and arguments.
|
String |
getMessage(String key,
Object... args)
Return translated message for given key and arguments using current user locale.
|
int |
hashCode() |
protected abstract String |
resolveMessage(String key,
Locale locale,
Object... args) |
void |
setParent(Translator parent)
Sets this translator parent.
|
void |
setTranslatedClassLoader(ClassLoader classLoader) |
ClassLoader |
translatedClassLoader()
ClassLoader, for which this translator will be registered.
|
Set<String> |
translatedPackages()
Packages, for which this translator will be registered.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetMessagespublic AbstractTranslator()
public AbstractTranslator(Translator parent)
public void addTranslatedPackage(String packageName)
packageName - package namepublic void setTranslatedClassLoader(ClassLoader classLoader)
public void setParent(Translator parent)
protected abstract String resolveMessage(String key, Locale locale, Object... args) throws NoTranslationException
NoTranslationExceptionpublic Set<String> translatedPackages()
PackageTranslatortranslatedPackages in interface PackageTranslatorpublic ClassLoader translatedClassLoader()
ClassLoaderTranslatortranslatedClassLoader in interface ClassLoaderTranslatorpublic String getMessage(String key, Locale locale, Object... args) throws NoTranslationException
TranslatorgetMessage in interface Translatorkey - message keylocale - localeargs - optional placeholder arguments (e.g. {0} {1})NoTranslationExceptionpublic String getMessage(String key) throws NoTranslationException
TranslatorgetMessage in interface TranslatorNoTranslationExceptionTranslator.getMessage(String, Locale, Object...)public String getMessage(String key, Locale locale) throws NoTranslationException
TranslatorgetMessage in interface TranslatorNoTranslationExceptionTranslator.getMessage(String, Locale, Object...)public String getMessage(String key, Object... args) throws NoTranslationException
TranslatorgetMessage in interface TranslatorNoTranslationExceptionTranslator.getMessage(String, Locale, Object...)public LocalizedString getLocalizedString(String key)
TranslatorgetLocalizedString in interface TranslatorTranslator.getLocalizedString(String, String, Locale, Object...)public LocalizedString getLocalizedString(String key, String defaultValue)
TranslatorgetLocalizedString in interface TranslatorTranslator.getLocalizedString(String, String, Locale, Object...)public LocalizedString getLocalizedString(String key, Locale locale)
TranslatorgetLocalizedString in interface TranslatorTranslator.getLocalizedString(String, String, Locale, Object...)public LocalizedString getLocalizedString(String key, String defaultValue, Locale locale)
TranslatorgetLocalizedString in interface TranslatorTranslator.getLocalizedString(String, String, Locale, Object...)public LocalizedString getLocalizedString(String key, Object... args)
TranslatorgetLocalizedString in interface TranslatorTranslator.getLocalizedString(String, String, Locale, Object...)public LocalizedString getLocalizedString(String key, String defaultValue, Object... args)
TranslatorgetLocalizedString in interface TranslatorTranslator.getLocalizedString(String, String, Locale, Object...)public LocalizedString getLocalizedString(String key, Locale locale, Object... args)
TranslatorgetLocalizedString in interface TranslatorTranslator.getLocalizedString(String, String, Locale, Object...)public LocalizedString getLocalizedString(String key, String defaultValue, Locale locale, Object... args)
TranslatorgetLocalizedString in interface Translatorkey - message keydefaultValue - default value returned when no translation could be foundlocale - localeargs - optional message arguments (e.g. {0} {1})LocalizedStringCopyright © 2016 Suncode. All rights reserved.