TranslatorOptions.Builder

public static class TranslatorOptions.Builder extends Object

Builder to create a TranslatorOptions instance.

Public Constructor Summary

Public Method Summary

TranslatorOptions
build()
Creates a new TranslatorOptions instance.
TranslatorOptions.Builder
setExecutor(Executor executor)
Sets the custom Executor to use.
TranslatorOptions.Builder
setSourceLanguage(String sourceLanguage)
Sets the language to translate from.
TranslatorOptions.Builder
setTargetLanguage(String targetLanguage)
Sets the language to translate to.

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)

Sets the custom Executor to use. If no Executor is set, an internal background thread pool will be used.

Most clients should not need to call this method.

Parameters
executor the Executor to use
Returns
  • this object, for chaining method calls

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