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 TranslateOptionsbuild()com.google.auth.CredentialsgetCredentials()Returns the authentication credentials.TranslateOptions.BuildersetApiKey(String apiKey)Deprecated.TranslateOptions.BuildersetProjectId(String projectId)Sets the project ID.TranslateOptions.BuildersetTargetLanguage(String targetLanguage)Sets the code for the default target language.TranslateOptions.BuildersetTransportOptions(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:
setTransportOptionsin 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 theTranslateservice.- Overrides:
setProjectIdin 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_KEYenvironment 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:
buildin classcom.google.cloud.ServiceOptions.Builder<Translate,TranslateOptions,TranslateOptions.Builder>
-
-