Package org.nuclos.api.l10n
Interface TranslatorFactory<T extends Translator>
- Type Parameters:
- T- The specific type of- Translatorthat this factory creates
public interface TranslatorFactory<T extends Translator>
Factory interface for creating 
Translator instances.
 This interface defines methods for creating, configuring and identifying translator implementations. It allows to instantiate specific translator types with appropriate configuration.
- 
Method SummaryModifier and TypeMethodDescriptiondefault booleanautoSetup(Locale sourceLocale, Locale targetLocale, javax.json.JsonObjectBuilder configBuilder, javax.json.JsonObject translatorBaseConfig) Attempts to perform an automatic setup for the givenlocales.javax.json.JsonObjectGets the default configuration for this translator as a JSON object.getName()Gets the name of this translator factory.Gets the class object for the translator type created by this factory.getUrl()Gets the URL associated with this translator factory.newInstance(javax.json.JsonObject jsonConfig) Creates a new instance of the translator with the specified JSON configuration.
- 
Method Details- 
getNameString getName()Gets the name of this translator factory.- Returns:
- The unique name that identifies this translator implementation
 
- 
getUrlURL getUrl()Gets the URL associated with this translator factory. This might be a documentation link.- Returns:
- The URL associated with this translator factory
 
- 
getDefaultConfigJsonjavax.json.JsonObject getDefaultConfigJson()Gets the default configuration for this translator as a JSON object.- Returns:
- The default configuration as a JSON object
 
- 
getTranslatorClassGets the class object for the translator type created by this factory.- Returns:
- The class object representing the translator type
 
- 
newInstanceCreates a new instance of the translator with the specified JSON configuration.- Parameters:
- jsonConfig- The JSON configuration to use when creating the translator instance
- Returns:
- A new translator instance
- Throws:
- Exception- If an error occurs while creating the translator instance
 
- 
autoSetupdefault boolean autoSetup(@NotNull Locale sourceLocale, @NotNull Locale targetLocale, @NotNull javax.json.JsonObjectBuilder configBuilder, @NotNull javax.json.JsonObject translatorBaseConfig) Attempts to perform an automatic setup for the givenlocales.If trueis returned, theconfigBuilderhas been filled with valid auto-setup values for the specified locale. Iffalse, no auto-setup was performed and theconfigBuilderremains unchanged.The optional translatorBaseConfigmay provide default values or fallbacks to use during the auto-setup.- Parameters:
- sourceLocale- the source- Localefor which to attempt auto-setup; must not be- null
- targetLocale- the target- Localefor which to attempt auto-setup; must not be- null
- configBuilder- the- JsonObjectBuilderinto which auto-setup configuration entries will be written; must not be- null
- translatorBaseConfig- an optional- JsonObjectcontaining base or fallback values for the auto-setup; may be- null
- Returns:
- trueif auto-setup was applied and- configBuilderwas populated;- falseif no auto-setup was performed
 
 
-