Class TranslationServiceSettings (2.54.0)

public class TranslationServiceSettings extends ClientSettings<TranslationServiceSettings>

Settings class to configure an instance of TranslationServiceClient.

The default instance has everything set to sensible defaults:

  • The default service address (translate.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the RetrySettings of translateText:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TranslationServiceSettings.Builder translationServiceSettingsBuilder =
     TranslationServiceSettings.newBuilder();
 translationServiceSettingsBuilder
     .translateTextSettings()
     .setRetrySettings(
         translationServiceSettingsBuilder
             .translateTextSettings()
             .getRetrySettings()
             .toBuilder()
             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
             .setMaxAttempts(5)
             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
             .setRetryDelayMultiplier(1.3)
             .setRpcTimeoutMultiplier(1.5)
             .setTotalTimeoutDuration(Duration.ofSeconds(300))
             .build());
 TranslationServiceSettings translationServiceSettings =
     translationServiceSettingsBuilder.build();
 

Please refer to the Client Side Retry Guide for additional support in setting retries.

To configure the RetrySettings of a Long Running Operation method, create an OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to configure the RetrySettings for batchTranslateText:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TranslationServiceSettings.Builder translationServiceSettingsBuilder =
     TranslationServiceSettings.newBuilder();
 TimedRetryAlgorithm timedRetryAlgorithm =
     OperationalTimedPollAlgorithm.create(
         RetrySettings.newBuilder()
             .setInitialRetryDelayDuration(Duration.ofMillis(500))
             .setRetryDelayMultiplier(1.5)
             .setMaxRetryDelayDuration(Duration.ofMillis(5000))
             .setTotalTimeoutDuration(Duration.ofHours(24))
             .build());
 translationServiceSettingsBuilder
     .createClusterOperationSettings()
     .setPollingAlgorithm(timedRetryAlgorithm)
     .build();
 

Inheritance

java.lang.Object > ClientSettings > TranslationServiceSettings

Static Methods

create(TranslationServiceStubSettings stub)

public static final TranslationServiceSettings create(TranslationServiceStubSettings stub)
Parameter
Name Description
stub TranslationServiceStubSettings
Returns
Type Description
TranslationServiceSettings
Exceptions
Type Description
IOException

defaultApiClientHeaderProviderBuilder()

public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder()
Returns
Type Description
Builder

defaultCredentialsProviderBuilder()

public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder()

Returns a builder for the default credentials for this service.

Returns
Type Description
Builder

defaultExecutorProviderBuilder()

public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder()

Returns a builder for the default ExecutorProvider for this service.

Returns
Type Description
Builder

defaultGrpcTransportProviderBuilder()

public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder()

Returns a builder for the default gRPC ChannelProvider for this service.

Returns
Type Description
Builder

defaultHttpJsonTransportProviderBuilder()

public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()

Returns a builder for the default REST ChannelProvider for this service.

Returns
Type Description
Builder

defaultTransportChannelProvider()

public static TransportChannelProvider defaultTransportChannelProvider()
Returns
Type Description
TransportChannelProvider

getDefaultEndpoint()

public static String getDefaultEndpoint()

Returns the default service endpoint.

Returns
Type Description
String

getDefaultServiceScopes()

public static List<String> getDefaultServiceScopes()

Returns the default service scopes.

Returns
Type Description
List<String>

newBuilder()

public static TranslationServiceSettings.Builder newBuilder()

Returns a new gRPC builder for this class.

Returns
Type Description
TranslationServiceSettings.Builder

newBuilder(ClientContext clientContext)

public static TranslationServiceSettings.Builder newBuilder(ClientContext clientContext)

Returns a new builder for this class.

Parameter
Name Description
clientContext ClientContext
Returns
Type Description
TranslationServiceSettings.Builder

newHttpJsonBuilder()

public static TranslationServiceSettings.Builder newHttpJsonBuilder()

Returns a new REST builder for this class.

Returns
Type Description
TranslationServiceSettings.Builder

Constructors

TranslationServiceSettings(TranslationServiceSettings.Builder settingsBuilder)

protected TranslationServiceSettings(TranslationServiceSettings.Builder settingsBuilder)
Parameter
Name Description
settingsBuilder TranslationServiceSettings.Builder

Methods

adaptiveMtTranslateSettings()

public UnaryCallSettings<AdaptiveMtTranslateRequest,AdaptiveMtTranslateResponse> adaptiveMtTranslateSettings()

Returns the object with the settings used for calls to adaptiveMtTranslate.

Returns
Type Description
UnaryCallSettings<AdaptiveMtTranslateRequest,AdaptiveMtTranslateResponse>

batchTranslateDocumentOperationSettings()

public OperationCallSettings<BatchTranslateDocumentRequest,BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentOperationSettings()

Returns the object with the settings used for calls to batchTranslateDocument.

Returns
Type Description
OperationCallSettings<BatchTranslateDocumentRequest,BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata>

batchTranslateDocumentSettings()

public UnaryCallSettings<BatchTranslateDocumentRequest,Operation> batchTranslateDocumentSettings()

Returns the object with the settings used for calls to batchTranslateDocument.

Returns
Type Description
UnaryCallSettings<BatchTranslateDocumentRequest,Operation>

batchTranslateTextOperationSettings()

public OperationCallSettings<BatchTranslateTextRequest,BatchTranslateResponse,BatchTranslateMetadata> batchTranslateTextOperationSettings()

Returns the object with the settings used for calls to batchTranslateText.

Returns
Type Description
OperationCallSettings<BatchTranslateTextRequest,BatchTranslateResponse,BatchTranslateMetadata>

batchTranslateTextSettings()

public UnaryCallSettings<BatchTranslateTextRequest,Operation> batchTranslateTextSettings()

Returns the object with the settings used for calls to batchTranslateText.

Returns
Type Description
UnaryCallSettings<BatchTranslateTextRequest,Operation>

createAdaptiveMtDatasetSettings()

public UnaryCallSettings<CreateAdaptiveMtDatasetRequest,AdaptiveMtDataset> createAdaptiveMtDatasetSettings()

Returns the object with the settings used for calls to createAdaptiveMtDataset.

Returns
Type Description
UnaryCallSettings<CreateAdaptiveMtDatasetRequest,AdaptiveMtDataset>

createDatasetOperationSettings()

public OperationCallSettings<CreateDatasetRequest,Dataset,CreateDatasetMetadata> createDatasetOperationSettings()

Returns the object with the settings used for calls to createDataset.

Returns
Type Description
OperationCallSettings<CreateDatasetRequest,Dataset,CreateDatasetMetadata>

createDatasetSettings()

public UnaryCallSettings<CreateDatasetRequest,Operation> createDatasetSettings()

Returns the object with the settings used for calls to createDataset.

Returns
Type Description
UnaryCallSettings<CreateDatasetRequest,Operation>

createGlossaryEntrySettings()

public UnaryCallSettings<CreateGlossaryEntryRequest,GlossaryEntry> createGlossaryEntrySettings()

Returns the object with the settings used for calls to createGlossaryEntry.

Returns
Type Description
UnaryCallSettings<CreateGlossaryEntryRequest,GlossaryEntry>

createGlossaryOperationSettings()

public OperationCallSettings<CreateGlossaryRequest,Glossary,CreateGlossaryMetadata> createGlossaryOperationSettings()

Returns the object with the settings used for calls to createGlossary.

Returns
Type Description
OperationCallSettings<CreateGlossaryRequest,Glossary,CreateGlossaryMetadata>

createGlossarySettings()

public UnaryCallSettings<CreateGlossaryRequest,Operation> createGlossarySettings()

Returns the object with the settings used for calls to createGlossary.

Returns
Type Description
UnaryCallSettings<CreateGlossaryRequest,Operation>

createModelOperationSettings()

public OperationCallSettings<CreateModelRequest,Model,CreateModelMetadata> createModelOperationSettings()

Returns the object with the settings used for calls to createModel.

Returns
Type Description
OperationCallSettings<CreateModelRequest,Model,CreateModelMetadata>

createModelSettings()

public UnaryCallSettings<CreateModelRequest,Operation> createModelSettings()

Returns the object with the settings used for calls to createModel.

Returns
Type Description
UnaryCallSettings<CreateModelRequest,Operation>

deleteAdaptiveMtDatasetSettings()

public UnaryCallSettings<DeleteAdaptiveMtDatasetRequest,Empty> deleteAdaptiveMtDatasetSettings()

Returns the object with the settings used for calls to deleteAdaptiveMtDataset.

Returns
Type Description
UnaryCallSettings<DeleteAdaptiveMtDatasetRequest,Empty>

deleteAdaptiveMtFileSettings()

public UnaryCallSettings<DeleteAdaptiveMtFileRequest,Empty> deleteAdaptiveMtFileSettings()

Returns the object with the settings used for calls to deleteAdaptiveMtFile.

Returns
Type Description
UnaryCallSettings<DeleteAdaptiveMtFileRequest,Empty>

deleteDatasetOperationSettings()

public OperationCallSettings<DeleteDatasetRequest,Empty,DeleteDatasetMetadata> deleteDatasetOperationSettings()

Returns the object with the settings used for calls to deleteDataset.

Returns
Type Description
OperationCallSettings<DeleteDatasetRequest,Empty,DeleteDatasetMetadata>

deleteDatasetSettings()

public UnaryCallSettings<DeleteDatasetRequest,Operation> deleteDatasetSettings()

Returns the object with the settings used for calls to deleteDataset.

Returns
Type Description
UnaryCallSettings<DeleteDatasetRequest,Operation>

deleteGlossaryEntrySettings()

public UnaryCallSettings<DeleteGlossaryEntryRequest,Empty> deleteGlossaryEntrySettings()

Returns the object with the settings used for calls to deleteGlossaryEntry.

Returns
Type Description
UnaryCallSettings<DeleteGlossaryEntryRequest,Empty>

deleteGlossaryOperationSettings()

public OperationCallSettings<DeleteGlossaryRequest,DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryOperationSettings()

Returns the object with the settings used for calls to deleteGlossary.

Returns
Type Description
OperationCallSettings<DeleteGlossaryRequest,DeleteGlossaryResponse,DeleteGlossaryMetadata>

deleteGlossarySettings()

public UnaryCallSettings<DeleteGlossaryRequest,Operation> deleteGlossarySettings()

Returns the object with the settings used for calls to deleteGlossary.

Returns
Type Description
UnaryCallSettings<DeleteGlossaryRequest,Operation>

deleteModelOperationSettings()

public OperationCallSettings<DeleteModelRequest,Empty,DeleteModelMetadata> deleteModelOperationSettings()

Returns the object with the settings used for calls to deleteModel.

Returns
Type Description
OperationCallSettings<DeleteModelRequest,Empty,DeleteModelMetadata>

deleteModelSettings()

public UnaryCallSettings<DeleteModelRequest,Operation> deleteModelSettings()

Returns the object with the settings used for calls to deleteModel.

Returns
Type Description
UnaryCallSettings<DeleteModelRequest,Operation>

detectLanguageSettings()

public UnaryCallSettings<DetectLanguageRequest,DetectLanguageResponse> detectLanguageSettings()

Returns the object with the settings used for calls to detectLanguage.

Returns
Type Description
UnaryCallSettings<DetectLanguageRequest,DetectLanguageResponse>

exportDataOperationSettings()

public OperationCallSettings<ExportDataRequest,Empty,ExportDataMetadata> exportDataOperationSettings()

Returns the object with the settings used for calls to exportData.

Returns
Type Description
OperationCallSettings<ExportDataRequest,Empty,ExportDataMetadata>

exportDataSettings()

public UnaryCallSettings<ExportDataRequest,Operation> exportDataSettings()

Returns the object with the settings used for calls to exportData.

Returns
Type Description
UnaryCallSettings<ExportDataRequest,Operation>

getAdaptiveMtDatasetSettings()

public UnaryCallSettings<GetAdaptiveMtDatasetRequest,AdaptiveMtDataset> getAdaptiveMtDatasetSettings()

Returns the object with the settings used for calls to getAdaptiveMtDataset.

Returns
Type Description
UnaryCallSettings<GetAdaptiveMtDatasetRequest,AdaptiveMtDataset>

getAdaptiveMtFileSettings()

public UnaryCallSettings<GetAdaptiveMtFileRequest,AdaptiveMtFile> getAdaptiveMtFileSettings()

Returns the object with the settings used for calls to getAdaptiveMtFile.

Returns
Type Description
UnaryCallSettings<GetAdaptiveMtFileRequest,AdaptiveMtFile>

getDatasetSettings()

public UnaryCallSettings<GetDatasetRequest,Dataset> getDatasetSettings()

Returns the object with the settings used for calls to getDataset.

Returns
Type Description
UnaryCallSettings<GetDatasetRequest,Dataset>

getGlossaryEntrySettings()

public UnaryCallSettings<GetGlossaryEntryRequest,GlossaryEntry> getGlossaryEntrySettings()

Returns the object with the settings used for calls to getGlossaryEntry.

Returns
Type Description
UnaryCallSettings<GetGlossaryEntryRequest,GlossaryEntry>

getGlossarySettings()

public UnaryCallSettings<GetGlossaryRequest,Glossary> getGlossarySettings()

Returns the object with the settings used for calls to getGlossary.

Returns
Type Description
UnaryCallSettings<GetGlossaryRequest,Glossary>

getModelSettings()

public UnaryCallSettings<GetModelRequest,Model> getModelSettings()

Returns the object with the settings used for calls to getModel.

Returns
Type Description
UnaryCallSettings<GetModelRequest,Model>

getSupportedLanguagesSettings()

public UnaryCallSettings<GetSupportedLanguagesRequest,SupportedLanguages> getSupportedLanguagesSettings()

Returns the object with the settings used for calls to getSupportedLanguages.

Returns
Type Description
UnaryCallSettings<GetSupportedLanguagesRequest,SupportedLanguages>

importAdaptiveMtFileSettings()

public UnaryCallSettings<ImportAdaptiveMtFileRequest,ImportAdaptiveMtFileResponse> importAdaptiveMtFileSettings()

Returns the object with the settings used for calls to importAdaptiveMtFile.

Returns
Type Description
UnaryCallSettings<ImportAdaptiveMtFileRequest,ImportAdaptiveMtFileResponse>

importDataOperationSettings()

public OperationCallSettings<ImportDataRequest,Empty,ImportDataMetadata> importDataOperationSettings()

Returns the object with the settings used for calls to importData.

Returns
Type Description
OperationCallSettings<ImportDataRequest,Empty,ImportDataMetadata>

importDataSettings()

public UnaryCallSettings<ImportDataRequest,Operation> importDataSettings()

Returns the object with the settings used for calls to importData.

Returns
Type Description
UnaryCallSettings<ImportDataRequest,Operation>

listAdaptiveMtDatasetsSettings()

public PagedCallSettings<ListAdaptiveMtDatasetsRequest,ListAdaptiveMtDatasetsResponse,TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse> listAdaptiveMtDatasetsSettings()

Returns the object with the settings used for calls to listAdaptiveMtDatasets.

Returns
Type Description
PagedCallSettings<ListAdaptiveMtDatasetsRequest,ListAdaptiveMtDatasetsResponse,ListAdaptiveMtDatasetsPagedResponse>

listAdaptiveMtFilesSettings()

public PagedCallSettings<ListAdaptiveMtFilesRequest,ListAdaptiveMtFilesResponse,TranslationServiceClient.ListAdaptiveMtFilesPagedResponse> listAdaptiveMtFilesSettings()

Returns the object with the settings used for calls to listAdaptiveMtFiles.

Returns
Type Description
PagedCallSettings<ListAdaptiveMtFilesRequest,ListAdaptiveMtFilesResponse,ListAdaptiveMtFilesPagedResponse>

listAdaptiveMtSentencesSettings()

public PagedCallSettings<ListAdaptiveMtSentencesRequest,ListAdaptiveMtSentencesResponse,TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse> listAdaptiveMtSentencesSettings()

Returns the object with the settings used for calls to listAdaptiveMtSentences.

Returns
Type Description
PagedCallSettings<ListAdaptiveMtSentencesRequest,ListAdaptiveMtSentencesResponse,ListAdaptiveMtSentencesPagedResponse>

listDatasetsSettings()

public PagedCallSettings<ListDatasetsRequest,ListDatasetsResponse,TranslationServiceClient.ListDatasetsPagedResponse> listDatasetsSettings()

Returns the object with the settings used for calls to listDatasets.

Returns
Type Description
PagedCallSettings<ListDatasetsRequest,ListDatasetsResponse,ListDatasetsPagedResponse>

listExamplesSettings()

public PagedCallSettings<ListExamplesRequest,ListExamplesResponse,TranslationServiceClient.ListExamplesPagedResponse> listExamplesSettings()

Returns the object with the settings used for calls to listExamples.

Returns
Type Description
PagedCallSettings<ListExamplesRequest,ListExamplesResponse,ListExamplesPagedResponse>

listGlossariesSettings()

public PagedCallSettings<ListGlossariesRequest,ListGlossariesResponse,TranslationServiceClient.ListGlossariesPagedResponse> listGlossariesSettings()

Returns the object with the settings used for calls to listGlossaries.

Returns
Type Description
PagedCallSettings<ListGlossariesRequest,ListGlossariesResponse,ListGlossariesPagedResponse>

listGlossaryEntriesSettings()

public PagedCallSettings<ListGlossaryEntriesRequest,ListGlossaryEntriesResponse,TranslationServiceClient.ListGlossaryEntriesPagedResponse> listGlossaryEntriesSettings()

Returns the object with the settings used for calls to listGlossaryEntries.

Returns
Type Description
PagedCallSettings<ListGlossaryEntriesRequest,ListGlossaryEntriesResponse,ListGlossaryEntriesPagedResponse>

listModelsSettings()

public PagedCallSettings<ListModelsRequest,ListModelsResponse,TranslationServiceClient.ListModelsPagedResponse> listModelsSettings()

Returns the object with the settings used for calls to listModels.

Returns
Type Description
PagedCallSettings<ListModelsRequest,ListModelsResponse,ListModelsPagedResponse>

romanizeTextSettings()

public UnaryCallSettings<RomanizeTextRequest,RomanizeTextResponse> romanizeTextSettings()

Returns the object with the settings used for calls to romanizeText.

Returns
Type Description
UnaryCallSettings<RomanizeTextRequest,RomanizeTextResponse>

toBuilder()

public TranslationServiceSettings.Builder toBuilder()

Returns a builder containing all the values of this settings class.

Returns
Type Description
TranslationServiceSettings.Builder
Overrides

translateDocumentSettings()

public UnaryCallSettings<TranslateDocumentRequest,TranslateDocumentResponse> translateDocumentSettings()

Returns the object with the settings used for calls to translateDocument.

Returns
Type Description
UnaryCallSettings<TranslateDocumentRequest,TranslateDocumentResponse>

translateTextSettings()

public UnaryCallSettings<TranslateTextRequest,TranslateTextResponse> translateTextSettings()

Returns the object with the settings used for calls to translateText.

Returns
Type Description
UnaryCallSettings<TranslateTextRequest,TranslateTextResponse>

updateGlossaryEntrySettings()

public UnaryCallSettings<UpdateGlossaryEntryRequest,GlossaryEntry> updateGlossaryEntrySettings()

Returns the object with the settings used for calls to updateGlossaryEntry.

Returns
Type Description
UnaryCallSettings<UpdateGlossaryEntryRequest,GlossaryEntry>

updateGlossaryOperationSettings()

public OperationCallSettings<UpdateGlossaryRequest,Glossary,UpdateGlossaryMetadata> updateGlossaryOperationSettings()

Returns the object with the settings used for calls to updateGlossary.

Returns
Type Description
OperationCallSettings<UpdateGlossaryRequest,Glossary,UpdateGlossaryMetadata>

updateGlossarySettings()

public UnaryCallSettings<UpdateGlossaryRequest,Operation> updateGlossarySettings()

Returns the object with the settings used for calls to updateGlossary.

Returns
Type Description
UnaryCallSettings<UpdateGlossaryRequest,Operation>