Package com.suncode.pwfl.translation
Interface TranslatorRegistry
Registry of available Translator. Translators are registered with
#register(Translator, TranslatorScope) method in given scope. Name must be unique
within given scope.
Additionally, if Translator
implements PackageTranslator
interface, then it is
possible to fetch him by package name.
- Author:
- Cezary Kozar 19 sie 2015
-
Method Summary
Modifier and TypeMethodDescriptionReturns Translator for package of given class registered in TranslatorScope.SERVER scope.Returns Translator with given name for scopeTranslatorScope.SERVER
.get
(String name, TranslatorScope scope) Returns Translator with given name and scope.getAll
(TranslatorScope scope) Returns all translators Translator with given scope.getAllByName
(TranslatorScope scope) Returns the map of all translators with the given scope, where key is the translator name.register
(String name, Translator translator, TranslatorScope scope) Registers given translator under provided name in given scope.
-
Method Details
-
get
Returns Translator with given name for scopeTranslatorScope.SERVER
. If there is no such translator, returns EmptyTranslator instance.- Parameters:
name
- translator name
-
getAll
Returns all translators Translator with given scope.- Parameters:
scope
-- Returns:
- translators list
-
getAllByName
Returns the map of all translators with the given scope, where key is the translator name.- Parameters:
scope
-- Returns:
- all translators map
-
get
Returns Translator with given name and scope. If there is no such translator, returns EmptyTranslator instance.- Parameters:
name
- translator namescope
- translator scope
-
forClass
Returns Translator for package of given class registered in TranslatorScope.SERVER scope. If there is no such translator, returns EmptyTranslator instance.- Parameters:
clazz
- class- See Also:
-
register
Registers given translator under provided name in given scope.NOTE: Translator name within single
TranslatorScope
must be unique.- Parameters:
name
- translator nametranslator
- registered translatorscope
- scope target scope
-