Class TranslateOptions.Builder (2.1.13)

public static class TranslateOptions.Builder extends ServiceOptions.Builder<Translate,TranslateOptions,TranslateOptions.Builder>

Inheritance

java.lang.Object > com.google.cloud.ServiceOptions.Builder > TranslateOptions.Builder

Methods

build()

public TranslateOptions build()
Returns
TypeDescription
TranslateOptions
Overrides
com.google.cloud.ServiceOptions.Builder.build()

getCredentials()

public Credentials getCredentials()

Returns the authentication credentials.

Returns
TypeDescription
com.google.auth.Credentials

setApiKey(String apiKey)

public TranslateOptions.Builder setApiKey(String apiKey)

Sets the API key used to issue requests. This will be ignored if credentials are explicitly set with setCredentials. If neither are set, and no Application Default Credentials are available, an API key is looked for in the GOOGLE_API_KEY environment variable. For instructions on how to get an API key, see the Translate Quickstart.

Parameter
NameDescription
apiKeyString
Returns
TypeDescription
TranslateOptions.Builder

setProjectId(String projectId)

public TranslateOptions.Builder setProjectId(String projectId)

Sets the project ID. Setting a project ID has no impact on the Translate service.

Parameter
NameDescription
projectIdString
Returns
TypeDescription
TranslateOptions.Builder

the builder

Overrides
com.google.cloud.ServiceOptions.Builder.setProjectId(java.lang.String)

setTargetLanguage(String targetLanguage)

public TranslateOptions.Builder setTargetLanguage(String targetLanguage)

Sets the code for the default target language. If not set, English (en) is used. Calls to Translate#translate(List, TranslateOption...) and Translate#translate(String, TranslateOption...) will use this value unless an option from TranslateOption#targetLanguage(String) is explicitly provided.

Parameter
NameDescription
targetLanguageString
Returns
TypeDescription
TranslateOptions.Builder

the builder

setTransportOptions(TransportOptions transportOptions)

public TranslateOptions.Builder setTransportOptions(TransportOptions transportOptions)
Parameter
NameDescription
transportOptionscom.google.cloud.TransportOptions
Returns
TypeDescription
TranslateOptions.Builder
Overrides
com.google.cloud.ServiceOptions.Builder.setTransportOptions(com.google.cloud.TransportOptions)