AI-generated Key Takeaways
-
TranslatorOptions.Builder
is used to createTranslatorOptions
instances for configuring translation tasks. -
You must specify the source and target languages using
setSourceLanguage
andsetTargetLanguage
before building the options. -
An optional custom
Executor
can be set viasetExecutor
for managing task execution, otherwise, a default thread pool is used. -
Calling
build()
creates an immutableTranslatorOptions
instance based on the builder's configuration.
Builder to create a TranslatorOptions
instance.
Public Constructor Summary
Builder()
|
Public Method Summary
TranslatorOptions |
build()
Creates a new
TranslatorOptions
instance.
|
TranslatorOptions.Builder | |
TranslatorOptions.Builder | |
TranslatorOptions.Builder |
Inherited Method Summary
Public Constructors
public Builder ()
Public Methods
public TranslatorOptions build ()
Creates a new TranslatorOptions
instance. The source and target language should be set before calling this method.
public TranslatorOptions.Builder setExecutor (Executor executor)
public TranslatorOptions.Builder setSourceLanguage (String sourceLanguage)
Sets the language to translate from.
Parameters
sourceLanguage |
the BCP 47 tag of the language to
translate from. The value must be one of the possible values for
TranslateLanguage.Language ).
|
---|
Returns
- this object, for chaining method calls
public TranslatorOptions.Builder setTargetLanguage (String targetLanguage)
Sets the language to translate to.
Parameters
targetLanguage |
the BCP 47 tag of the language to
translate to. The value must be one of the possible values for
TranslateLanguage.Language ).
|
---|
Returns
- this object, for chaining method calls