Class TranslateOptions.Builder (2.51.0)

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
Type Description
TranslateOptions
Overrides
com.google.cloud.ServiceOptions.Builder.build()

getCredentials()

public Credentials getCredentials()

Returns the authentication credentials.

Returns
Type Description
com.google.auth.Credentials

setApiKey(String apiKey) (deprecated)

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
Name Description
apiKey String
Returns
Type Description
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
Name Description
projectId String
Returns
Type Description
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
Name Description
targetLanguage String
Returns
Type Description
TranslateOptions.Builder

the builder

setTransportOptions(TransportOptions transportOptions)

public TranslateOptions.Builder setTransportOptions(TransportOptions transportOptions)
Parameter
Name Description
transportOptions com.google.cloud.TransportOptions
Returns
Type Description
TranslateOptions.Builder
Overrides
com.google.cloud.ServiceOptions.Builder.setTransportOptions(com.google.cloud.TransportOptions)