Package com.google.cloud.translate
Class TranslateOptions.Builder
- java.lang.Object
-
- com.google.cloud.ServiceOptions.Builder<Translate,TranslateOptions,TranslateOptions.Builder>
-
- com.google.cloud.translate.TranslateOptions.Builder
-
- Enclosing class:
- TranslateOptions
public static class TranslateOptions.Builder extends com.google.cloud.ServiceOptions.Builder<Translate,TranslateOptions,TranslateOptions.Builder>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TranslateOptions
build()
com.google.auth.Credentials
getCredentials()
Returns the authentication credentials.TranslateOptions.Builder
setApiKey(String apiKey)
Deprecated.TranslateOptions.Builder
setProjectId(String projectId)
Sets the project ID.TranslateOptions.Builder
setTargetLanguage(String targetLanguage)
Sets the code for the default target language.TranslateOptions.Builder
setTransportOptions(com.google.cloud.TransportOptions transportOptions)
-
-
-
Method Detail
-
getCredentials
public com.google.auth.Credentials getCredentials()
Returns the authentication credentials.
-
setTransportOptions
public TranslateOptions.Builder setTransportOptions(com.google.cloud.TransportOptions transportOptions)
- Overrides:
setTransportOptions
in classcom.google.cloud.ServiceOptions.Builder<Translate,TranslateOptions,TranslateOptions.Builder>
-
setProjectId
public TranslateOptions.Builder setProjectId(String projectId)
Sets the project ID. Setting a project ID has no impact on theTranslate
service.- Overrides:
setProjectId
in classcom.google.cloud.ServiceOptions.Builder<Translate,TranslateOptions,TranslateOptions.Builder>
- Returns:
- the builder
-
setApiKey
@Deprecated public TranslateOptions.Builder setApiKey(String apiKey)
Deprecated.Sets the API key used to issue requests. This will be ignored if credentials are explicitly set withsetCredentials
. If neither are set, and no Application Default Credentials are available, an API key is looked for in theGOOGLE_API_KEY
environment variable. For instructions on how to get an API key, see the Translate Quickstart.
-
setTargetLanguage
public TranslateOptions.Builder setTargetLanguage(String targetLanguage)
Sets the code for the default target language. If not set, English (en
) is used. Calls toTranslate.translate(List, TranslateOption...)
andTranslate.translate(String, TranslateOption...)
will use this value unless an option fromTranslate.TranslateOption.targetLanguage(String)
is explicitly provided.- Returns:
- the builder
-
build
public TranslateOptions build()
- Specified by:
build
in classcom.google.cloud.ServiceOptions.Builder<Translate,TranslateOptions,TranslateOptions.Builder>
-
-