diff --git a/google-cloud-translate-bom/pom.xml b/google-cloud-translate-bom/pom.xml index 01cb02c9..3da38ac2 100644 --- a/google-cloud-translate-bom/pom.xml +++ b/google-cloud-translate-bom/pom.xml @@ -65,12 +65,21 @@ com.google.api.grpc grpc-google-cloud-translate-v3beta1 0.76.1-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-translate-v3 + 0.76.1-SNAPSHOT com.google.api.grpc proto-google-cloud-translate-v3beta1 0.76.1-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-translate-v3 + 0.76.1-SNAPSHOT + com.google.cloud google-cloud-translate diff --git a/google-cloud-translate/pom.xml b/google-cloud-translate/pom.xml index f33d59ec..a491f15c 100644 --- a/google-cloud-translate/pom.xml +++ b/google-cloud-translate/pom.xml @@ -46,6 +46,10 @@ com.google.api.grpc proto-google-cloud-translate-v3beta1 + + com.google.api.grpc + proto-google-cloud-translate-v3 + com.google.guava guava @@ -107,6 +111,11 @@ grpc-google-cloud-translate-v3beta1 test + + com.google.api.grpc + grpc-google-cloud-translate-v3 + test + com.google.cloud google-cloud-core diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceClient.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceClient.java new file mode 100644 index 00000000..07a9cd49 --- /dev/null +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceClient.java @@ -0,0 +1,1445 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.translate.v3.stub.TranslationServiceStub; +import com.google.cloud.translate.v3.stub.TranslationServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Provides natural language translation operations. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ *   String targetLanguageCode = "";
+ *   List<String> contents = new ArrayList<>();
+ *   TranslateTextResponse response = translationServiceClient.translateText(parent, targetLanguageCode, contents);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the translationServiceClient object to clean up resources + * such as threads. In the example above, try-with-resources is used, which automatically calls + * close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TranslationServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * TranslationServiceSettings translationServiceSettings =
+ *     TranslationServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TranslationServiceClient translationServiceClient =
+ *     TranslationServiceClient.create(translationServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * TranslationServiceSettings translationServiceSettings =
+ *     TranslationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TranslationServiceClient translationServiceClient =
+ *     TranslationServiceClient.create(translationServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TranslationServiceClient implements BackgroundResource { + private final TranslationServiceSettings settings; + private final TranslationServiceStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of TranslationServiceClient with default settings. */ + public static final TranslationServiceClient create() throws IOException { + return create(TranslationServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of TranslationServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final TranslationServiceClient create(TranslationServiceSettings settings) + throws IOException { + return new TranslationServiceClient(settings); + } + + /** + * Constructs an instance of TranslationServiceClient, using the given stub for making calls. This + * is for advanced usage - prefer to use TranslationServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final TranslationServiceClient create(TranslationServiceStub stub) { + return new TranslationServiceClient(stub); + } + + /** + * Constructs an instance of TranslationServiceClient, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected TranslationServiceClient(TranslationServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((TranslationServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected TranslationServiceClient(TranslationServiceStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final TranslationServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TranslationServiceStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates input text and returns translated text. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String targetLanguageCode = "";
+   *   List<String> contents = new ArrayList<>();
+   *   TranslateTextResponse response = translationServiceClient.translateText(parent, targetLanguageCode, contents);
+   * }
+   * 
+ * + * @param parent Required. Project or location to make a call. Must refer to a caller's project. + *

Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + *

For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + *

Non-global location is required for requests using AutoML models or custom glossaries. + *

Models and glossaries must be within the same region (have same location-id), otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @param targetLanguageCode Required. The BCP-47 language code to use for translation of the + * input text, set to one of the language codes listed in Language Support. + * @param contents Required. The content of the input in string format. We recommend the total + * content be less than 30k codepoints. Use BatchTranslateText for larger text. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TranslateTextResponse translateText( + LocationName parent, String targetLanguageCode, List contents) { + + TranslateTextRequest request = + TranslateTextRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setTargetLanguageCode(targetLanguageCode) + .addAllContents(contents) + .build(); + return translateText(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates input text and returns translated text. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String targetLanguageCode = "";
+   *   List<String> contents = new ArrayList<>();
+   *   TranslateTextResponse response = translationServiceClient.translateText(parent.toString(), targetLanguageCode, contents);
+   * }
+   * 
+ * + * @param parent Required. Project or location to make a call. Must refer to a caller's project. + *

Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + *

For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + *

Non-global location is required for requests using AutoML models or custom glossaries. + *

Models and glossaries must be within the same region (have same location-id), otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @param targetLanguageCode Required. The BCP-47 language code to use for translation of the + * input text, set to one of the language codes listed in Language Support. + * @param contents Required. The content of the input in string format. We recommend the total + * content be less than 30k codepoints. Use BatchTranslateText for larger text. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TranslateTextResponse translateText( + String parent, String targetLanguageCode, List contents) { + + TranslateTextRequest request = + TranslateTextRequest.newBuilder() + .setParent(parent) + .setTargetLanguageCode(targetLanguageCode) + .addAllContents(contents) + .build(); + return translateText(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates input text and returns translated text. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String model = "";
+   *   String mimeType = "";
+   *   String sourceLanguageCode = "";
+   *   String targetLanguageCode = "";
+   *   List<String> contents = new ArrayList<>();
+   *   TranslateTextResponse response = translationServiceClient.translateText(parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);
+   * }
+   * 
+ * + * @param parent Required. Project or location to make a call. Must refer to a caller's project. + *

Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + *

For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + *

Non-global location is required for requests using AutoML models or custom glossaries. + *

Models and glossaries must be within the same region (have same location-id), otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @param model Optional. The `model` type requested for this translation. + *

The format depends on model type: + *

- AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + *

- General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + *

For global (non-regionalized) requests, use `location-id` `global`. For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + *

If missing, the system decides which google base model to use. + * @param mimeType Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param sourceLanguageCode Optional. The BCP-47 language code of the input text if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If + * the source language isn't specified, the API attempts to identify the source language + * automatically and returns the source language within the response. + * @param targetLanguageCode Required. The BCP-47 language code to use for translation of the + * input text, set to one of the language codes listed in Language Support. + * @param contents Required. The content of the input in string format. We recommend the total + * content be less than 30k codepoints. Use BatchTranslateText for larger text. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TranslateTextResponse translateText( + LocationName parent, + String model, + String mimeType, + String sourceLanguageCode, + String targetLanguageCode, + List contents) { + + TranslateTextRequest request = + TranslateTextRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setModel(model) + .setMimeType(mimeType) + .setSourceLanguageCode(sourceLanguageCode) + .setTargetLanguageCode(targetLanguageCode) + .addAllContents(contents) + .build(); + return translateText(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates input text and returns translated text. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String model = "";
+   *   String mimeType = "";
+   *   String sourceLanguageCode = "";
+   *   String targetLanguageCode = "";
+   *   List<String> contents = new ArrayList<>();
+   *   TranslateTextResponse response = translationServiceClient.translateText(parent.toString(), model, mimeType, sourceLanguageCode, targetLanguageCode, contents);
+   * }
+   * 
+ * + * @param parent Required. Project or location to make a call. Must refer to a caller's project. + *

Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + *

For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + *

Non-global location is required for requests using AutoML models or custom glossaries. + *

Models and glossaries must be within the same region (have same location-id), otherwise + * an INVALID_ARGUMENT (400) error is returned. + * @param model Optional. The `model` type requested for this translation. + *

The format depends on model type: + *

- AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + *

- General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + *

For global (non-regionalized) requests, use `location-id` `global`. For example, + * `projects/{project-number-or-id}/locations/global/models/general/nmt`. + *

If missing, the system decides which google base model to use. + * @param mimeType Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param sourceLanguageCode Optional. The BCP-47 language code of the input text if known, for + * example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If + * the source language isn't specified, the API attempts to identify the source language + * automatically and returns the source language within the response. + * @param targetLanguageCode Required. The BCP-47 language code to use for translation of the + * input text, set to one of the language codes listed in Language Support. + * @param contents Required. The content of the input in string format. We recommend the total + * content be less than 30k codepoints. Use BatchTranslateText for larger text. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TranslateTextResponse translateText( + String parent, + String model, + String mimeType, + String sourceLanguageCode, + String targetLanguageCode, + List contents) { + + TranslateTextRequest request = + TranslateTextRequest.newBuilder() + .setParent(parent) + .setModel(model) + .setMimeType(mimeType) + .setSourceLanguageCode(sourceLanguageCode) + .setTargetLanguageCode(targetLanguageCode) + .addAllContents(contents) + .build(); + return translateText(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates input text and returns translated text. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   List<String> contents = new ArrayList<>();
+   *   String targetLanguageCode = "";
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   TranslateTextRequest request = TranslateTextRequest.newBuilder()
+   *     .addAllContents(contents)
+   *     .setTargetLanguageCode(targetLanguageCode)
+   *     .setParent(parent.toString())
+   *     .build();
+   *   TranslateTextResponse response = translationServiceClient.translateText(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TranslateTextResponse translateText(TranslateTextRequest request) { + return translateTextCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates input text and returns translated text. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   List<String> contents = new ArrayList<>();
+   *   String targetLanguageCode = "";
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   TranslateTextRequest request = TranslateTextRequest.newBuilder()
+   *     .addAllContents(contents)
+   *     .setTargetLanguageCode(targetLanguageCode)
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<TranslateTextResponse> future = translationServiceClient.translateTextCallable().futureCall(request);
+   *   // Do something
+   *   TranslateTextResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable translateTextCallable() { + return stub.translateTextCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Detects the language of text within a request. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String model = "";
+   *   String mimeType = "";
+   *   String content = "";
+   *   DetectLanguageResponse response = translationServiceClient.detectLanguage(parent, model, mimeType, content);
+   * }
+   * 
+ * + * @param parent Required. Project or location to make a call. Must refer to a caller's project. + *

Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + *

For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + *

Only models within the same region (has same location-id) can be used. Otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @param model Optional. The language detection model to be used. + *

Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + *

Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + *

If not specified, the default model is used. + * @param mimeType Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param content The content of the input stored as a string. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DetectLanguageResponse detectLanguage( + LocationName parent, String model, String mimeType, String content) { + + DetectLanguageRequest request = + DetectLanguageRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setModel(model) + .setMimeType(mimeType) + .setContent(content) + .build(); + return detectLanguage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Detects the language of text within a request. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String model = "";
+   *   String mimeType = "";
+   *   String content = "";
+   *   DetectLanguageResponse response = translationServiceClient.detectLanguage(parent.toString(), model, mimeType, content);
+   * }
+   * 
+ * + * @param parent Required. Project or location to make a call. Must refer to a caller's project. + *

Format: `projects/{project-number-or-id}/locations/{location-id}` or + * `projects/{project-number-or-id}`. + *

For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + *

Only models within the same region (has same location-id) can be used. Otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @param model Optional. The language detection model to be used. + *

Format: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + *

Only one language detection model is currently supported: + * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + *

If not specified, the default model is used. + * @param mimeType Optional. The format of the source text, for example, "text/html", + * "text/plain". If left blank, the MIME type defaults to "text/html". + * @param content The content of the input stored as a string. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DetectLanguageResponse detectLanguage( + String parent, String model, String mimeType, String content) { + + DetectLanguageRequest request = + DetectLanguageRequest.newBuilder() + .setParent(parent) + .setModel(model) + .setMimeType(mimeType) + .setContent(content) + .build(); + return detectLanguage(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Detects the language of text within a request. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   DetectLanguageRequest request = DetectLanguageRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   DetectLanguageResponse response = translationServiceClient.detectLanguage(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DetectLanguageResponse detectLanguage(DetectLanguageRequest request) { + return detectLanguageCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Detects the language of text within a request. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   DetectLanguageRequest request = DetectLanguageRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<DetectLanguageResponse> future = translationServiceClient.detectLanguageCallable().futureCall(request);
+   *   // Do something
+   *   DetectLanguageResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + detectLanguageCallable() { + return stub.detectLanguageCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of supported languages for translation. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String model = "";
+   *   String displayLanguageCode = "";
+   *   SupportedLanguages response = translationServiceClient.getSupportedLanguages(parent, model, displayLanguageCode);
+   * }
+   * 
+ * + * @param parent Required. Project or location to make a call. Must refer to a caller's project. + *

Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + *

For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + *

Non-global location is required for AutoML models. + *

Only models within the same region (have same location-id) can be used, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @param model Optional. Get supported languages of this model. + *

The format depends on model type: + *

- AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + *

- General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + *

Returns languages supported by the specified model. If missing, we get supported + * languages of Google general base (PBMT) model. + * @param displayLanguageCode Optional. The language to use to return localized, human readable + * names of supported languages. If missing, then display names are not returned in a + * response. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SupportedLanguages getSupportedLanguages( + LocationName parent, String model, String displayLanguageCode) { + + GetSupportedLanguagesRequest request = + GetSupportedLanguagesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setModel(model) + .setDisplayLanguageCode(displayLanguageCode) + .build(); + return getSupportedLanguages(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of supported languages for translation. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String model = "";
+   *   String displayLanguageCode = "";
+   *   SupportedLanguages response = translationServiceClient.getSupportedLanguages(parent.toString(), model, displayLanguageCode);
+   * }
+   * 
+ * + * @param parent Required. Project or location to make a call. Must refer to a caller's project. + *

Format: `projects/{project-number-or-id}` or + * `projects/{project-number-or-id}/locations/{location-id}`. + *

For global calls, use `projects/{project-number-or-id}/locations/global` or + * `projects/{project-number-or-id}`. + *

Non-global location is required for AutoML models. + *

Only models within the same region (have same location-id) can be used, otherwise an + * INVALID_ARGUMENT (400) error is returned. + * @param model Optional. Get supported languages of this model. + *

The format depends on model type: + *

- AutoML Translation models: + * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + *

- General (built-in) models: + * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + * `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + *

Returns languages supported by the specified model. If missing, we get supported + * languages of Google general base (PBMT) model. + * @param displayLanguageCode Optional. The language to use to return localized, human readable + * names of supported languages. If missing, then display names are not returned in a + * response. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SupportedLanguages getSupportedLanguages( + String parent, String model, String displayLanguageCode) { + + GetSupportedLanguagesRequest request = + GetSupportedLanguagesRequest.newBuilder() + .setParent(parent) + .setModel(model) + .setDisplayLanguageCode(displayLanguageCode) + .build(); + return getSupportedLanguages(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of supported languages for translation. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   GetSupportedLanguagesRequest request = GetSupportedLanguagesRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   SupportedLanguages response = translationServiceClient.getSupportedLanguages(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final SupportedLanguages getSupportedLanguages(GetSupportedLanguagesRequest request) { + return getSupportedLanguagesCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of supported languages for translation. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   GetSupportedLanguagesRequest request = GetSupportedLanguagesRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<SupportedLanguages> future = translationServiceClient.getSupportedLanguagesCallable().futureCall(request);
+   *   // Do something
+   *   SupportedLanguages response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + getSupportedLanguagesCallable() { + return stub.getSupportedLanguagesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates a large volume of text in asynchronous batch mode. This function provides real-time + * output as the inputs are being processed. If caller cancels a request, the partial results (for + * an input file, it's all or nothing) may still be available on the specified output location. + * + *

This call returns immediately and you can use google.longrunning.Operation.name to poll the + * status of the call. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String sourceLanguageCode = "";
+   *   List<String> targetLanguageCodes = new ArrayList<>();
+   *   List<InputConfig> inputConfigs = new ArrayList<>();
+   *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
+   *   BatchTranslateTextRequest request = BatchTranslateTextRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setSourceLanguageCode(sourceLanguageCode)
+   *     .addAllTargetLanguageCodes(targetLanguageCodes)
+   *     .addAllInputConfigs(inputConfigs)
+   *     .setOutputConfig(outputConfig)
+   *     .build();
+   *   BatchTranslateResponse response = translationServiceClient.batchTranslateTextAsync(request).get();
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + batchTranslateTextAsync(BatchTranslateTextRequest request) { + return batchTranslateTextOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates a large volume of text in asynchronous batch mode. This function provides real-time + * output as the inputs are being processed. If caller cancels a request, the partial results (for + * an input file, it's all or nothing) may still be available on the specified output location. + * + *

This call returns immediately and you can use google.longrunning.Operation.name to poll the + * status of the call. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String sourceLanguageCode = "";
+   *   List<String> targetLanguageCodes = new ArrayList<>();
+   *   List<InputConfig> inputConfigs = new ArrayList<>();
+   *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
+   *   BatchTranslateTextRequest request = BatchTranslateTextRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setSourceLanguageCode(sourceLanguageCode)
+   *     .addAllTargetLanguageCodes(targetLanguageCodes)
+   *     .addAllInputConfigs(inputConfigs)
+   *     .setOutputConfig(outputConfig)
+   *     .build();
+   *   OperationFuture<BatchTranslateResponse, BatchTranslateMetadata> future = translationServiceClient.batchTranslateTextOperationCallable().futureCall(request);
+   *   // Do something
+   *   BatchTranslateResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationCallable() { + return stub.batchTranslateTextOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Translates a large volume of text in asynchronous batch mode. This function provides real-time + * output as the inputs are being processed. If caller cancels a request, the partial results (for + * an input file, it's all or nothing) may still be available on the specified output location. + * + *

This call returns immediately and you can use google.longrunning.Operation.name to poll the + * status of the call. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String sourceLanguageCode = "";
+   *   List<String> targetLanguageCodes = new ArrayList<>();
+   *   List<InputConfig> inputConfigs = new ArrayList<>();
+   *   OutputConfig outputConfig = OutputConfig.newBuilder().build();
+   *   BatchTranslateTextRequest request = BatchTranslateTextRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setSourceLanguageCode(sourceLanguageCode)
+   *     .addAllTargetLanguageCodes(targetLanguageCodes)
+   *     .addAllInputConfigs(inputConfigs)
+   *     .setOutputConfig(outputConfig)
+   *     .build();
+   *   ApiFuture<Operation> future = translationServiceClient.batchTranslateTextCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable batchTranslateTextCallable() { + return stub.batchTranslateTextCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project + * doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Glossary glossary = Glossary.newBuilder().build();
+   *   Glossary response = translationServiceClient.createGlossaryAsync(parent, glossary).get();
+   * }
+   * 
+ * + * @param parent Required. The project name. + * @param glossary Required. The glossary to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture createGlossaryAsync( + LocationName parent, Glossary glossary) { + + CreateGlossaryRequest request = + CreateGlossaryRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setGlossary(glossary) + .build(); + return createGlossaryAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project + * doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Glossary glossary = Glossary.newBuilder().build();
+   *   Glossary response = translationServiceClient.createGlossaryAsync(parent.toString(), glossary).get();
+   * }
+   * 
+ * + * @param parent Required. The project name. + * @param glossary Required. The glossary to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture createGlossaryAsync( + String parent, Glossary glossary) { + + CreateGlossaryRequest request = + CreateGlossaryRequest.newBuilder().setParent(parent).setGlossary(glossary).build(); + return createGlossaryAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project + * doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Glossary glossary = Glossary.newBuilder().build();
+   *   CreateGlossaryRequest request = CreateGlossaryRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setGlossary(glossary)
+   *     .build();
+   *   Glossary response = translationServiceClient.createGlossaryAsync(request).get();
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture createGlossaryAsync( + CreateGlossaryRequest request) { + return createGlossaryOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project + * doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Glossary glossary = Glossary.newBuilder().build();
+   *   CreateGlossaryRequest request = CreateGlossaryRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setGlossary(glossary)
+   *     .build();
+   *   OperationFuture<Glossary, CreateGlossaryMetadata> future = translationServiceClient.createGlossaryOperationCallable().futureCall(request);
+   *   // Do something
+   *   Glossary response = future.get();
+   * }
+   * 
+ */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable + createGlossaryOperationCallable() { + return stub.createGlossaryOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project + * doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Glossary glossary = Glossary.newBuilder().build();
+   *   CreateGlossaryRequest request = CreateGlossaryRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setGlossary(glossary)
+   *     .build();
+   *   ApiFuture<Operation> future = translationServiceClient.createGlossaryCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createGlossaryCallable() { + return stub.createGlossaryCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Glossary element : translationServiceClient.listGlossaries(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The name of the project from which to list all of the glossaries. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGlossariesPagedResponse listGlossaries(LocationName parent) { + ListGlossariesRequest request = + ListGlossariesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listGlossaries(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Glossary element : translationServiceClient.listGlossaries(parent.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The name of the project from which to list all of the glossaries. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGlossariesPagedResponse listGlossaries(String parent) { + ListGlossariesRequest request = ListGlossariesRequest.newBuilder().setParent(parent).build(); + return listGlossaries(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ListGlossariesRequest request = ListGlossariesRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   for (Glossary element : translationServiceClient.listGlossaries(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGlossariesPagedResponse listGlossaries(ListGlossariesRequest request) { + return listGlossariesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ListGlossariesRequest request = ListGlossariesRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<ListGlossariesPagedResponse> future = translationServiceClient.listGlossariesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Glossary element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listGlossariesPagedCallable() { + return stub.listGlossariesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ListGlossariesRequest request = ListGlossariesRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   while (true) {
+   *     ListGlossariesResponse response = translationServiceClient.listGlossariesCallable().call(request);
+   *     for (Glossary element : response.getGlossariesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listGlossariesCallable() { + return stub.listGlossariesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   Glossary response = translationServiceClient.getGlossary(name);
+   * }
+   * 
+ * + * @param name Required. The name of the glossary to retrieve. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Glossary getGlossary(GlossaryName name) { + + GetGlossaryRequest request = + GetGlossaryRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getGlossary(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   Glossary response = translationServiceClient.getGlossary(name.toString());
+   * }
+   * 
+ * + * @param name Required. The name of the glossary to retrieve. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Glossary getGlossary(String name) { + + GetGlossaryRequest request = GetGlossaryRequest.newBuilder().setName(name).build(); + return getGlossary(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   GetGlossaryRequest request = GetGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   Glossary response = translationServiceClient.getGlossary(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Glossary getGlossary(GetGlossaryRequest request) { + return getGlossaryCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   GetGlossaryRequest request = GetGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Glossary> future = translationServiceClient.getGlossaryCallable().futureCall(request);
+   *   // Do something
+   *   Glossary response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getGlossaryCallable() { + return stub.getGlossaryCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
+   * }
+   * 
+ * + * @param name Required. The name of the glossary to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + GlossaryName name) { + + DeleteGlossaryRequest request = + DeleteGlossaryRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteGlossaryAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name.toString()).get();
+   * }
+   * 
+ * + * @param name Required. The name of the glossary to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + String name) { + + DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder().setName(name).build(); + return deleteGlossaryAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(request).get();
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture deleteGlossaryAsync( + DeleteGlossaryRequest request) { + return deleteGlossaryOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   OperationFuture<DeleteGlossaryResponse, DeleteGlossaryMetadata> future = translationServiceClient.deleteGlossaryOperationCallable().futureCall(request);
+   *   // Do something
+   *   DeleteGlossaryResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationCallable() { + return stub.deleteGlossaryOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns + * NOT_FOUND, if the glossary doesn't exist. + * + *

Sample code: + * + *


+   * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
+   *   DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = translationServiceClient.deleteGlossaryCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteGlossaryCallable() { + return stub.deleteGlossaryCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListGlossariesPagedResponse + extends AbstractPagedListResponse< + ListGlossariesRequest, + ListGlossariesResponse, + Glossary, + ListGlossariesPage, + ListGlossariesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListGlossariesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListGlossariesPagedResponse apply(ListGlossariesPage input) { + return new ListGlossariesPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListGlossariesPagedResponse(ListGlossariesPage page) { + super(page, ListGlossariesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListGlossariesPage + extends AbstractPage< + ListGlossariesRequest, ListGlossariesResponse, Glossary, ListGlossariesPage> { + + private ListGlossariesPage( + PageContext context, + ListGlossariesResponse response) { + super(context, response); + } + + private static ListGlossariesPage createEmptyPage() { + return new ListGlossariesPage(null, null); + } + + @Override + protected ListGlossariesPage createPage( + PageContext context, + ListGlossariesResponse response) { + return new ListGlossariesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListGlossariesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListGlossariesRequest, + ListGlossariesResponse, + Glossary, + ListGlossariesPage, + ListGlossariesFixedSizeCollection> { + + private ListGlossariesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListGlossariesFixedSizeCollection createEmptyCollection() { + return new ListGlossariesFixedSizeCollection(null, 0); + } + + @Override + protected ListGlossariesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListGlossariesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceSettings.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceSettings.java new file mode 100644 index 00000000..47d6f6fe --- /dev/null +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/TranslationServiceSettings.java @@ -0,0 +1,312 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3; + +import static com.google.cloud.translate.v3.TranslationServiceClient.ListGlossariesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.translate.v3.stub.TranslationServiceStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link 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 total timeout of translateText to 30 seconds: + * + *

+ * 
+ * TranslationServiceSettings.Builder translationServiceSettingsBuilder =
+ *     TranslationServiceSettings.newBuilder();
+ * translationServiceSettingsBuilder.translateTextSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TranslationServiceSettings translationServiceSettings = translationServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TranslationServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to translateText. */ + public UnaryCallSettings translateTextSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).translateTextSettings(); + } + + /** Returns the object with the settings used for calls to detectLanguage. */ + public UnaryCallSettings detectLanguageSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).detectLanguageSettings(); + } + + /** Returns the object with the settings used for calls to getSupportedLanguages. */ + public UnaryCallSettings + getSupportedLanguagesSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).getSupportedLanguagesSettings(); + } + + /** Returns the object with the settings used for calls to batchTranslateText. */ + public UnaryCallSettings batchTranslateTextSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).batchTranslateTextSettings(); + } + + /** Returns the object with the settings used for calls to batchTranslateText. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationSettings() { + return ((TranslationServiceStubSettings) getStubSettings()) + .batchTranslateTextOperationSettings(); + } + + /** Returns the object with the settings used for calls to createGlossary. */ + public UnaryCallSettings createGlossarySettings() { + return ((TranslationServiceStubSettings) getStubSettings()).createGlossarySettings(); + } + + /** Returns the object with the settings used for calls to createGlossary. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + createGlossaryOperationSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).createGlossaryOperationSettings(); + } + + /** Returns the object with the settings used for calls to listGlossaries. */ + public PagedCallSettings< + ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> + listGlossariesSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).listGlossariesSettings(); + } + + /** Returns the object with the settings used for calls to getGlossary. */ + public UnaryCallSettings getGlossarySettings() { + return ((TranslationServiceStubSettings) getStubSettings()).getGlossarySettings(); + } + + /** Returns the object with the settings used for calls to deleteGlossary. */ + public UnaryCallSettings deleteGlossarySettings() { + return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossarySettings(); + } + + /** Returns the object with the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return ((TranslationServiceStubSettings) getStubSettings()).deleteGlossaryOperationSettings(); + } + + public static final TranslationServiceSettings create(TranslationServiceStubSettings stub) + throws IOException { + return new TranslationServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TranslationServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TranslationServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TranslationServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TranslationServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return TranslationServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TranslationServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TranslationServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TranslationServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TranslationServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(TranslationServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(TranslationServiceStubSettings.newBuilder()); + } + + protected Builder(TranslationServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TranslationServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public TranslationServiceStubSettings.Builder getStubSettingsBuilder() { + return ((TranslationServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to translateText. */ + public UnaryCallSettings.Builder + translateTextSettings() { + return getStubSettingsBuilder().translateTextSettings(); + } + + /** Returns the builder for the settings used for calls to detectLanguage. */ + public UnaryCallSettings.Builder + detectLanguageSettings() { + return getStubSettingsBuilder().detectLanguageSettings(); + } + + /** Returns the builder for the settings used for calls to getSupportedLanguages. */ + public UnaryCallSettings.Builder + getSupportedLanguagesSettings() { + return getStubSettingsBuilder().getSupportedLanguagesSettings(); + } + + /** Returns the builder for the settings used for calls to batchTranslateText. */ + public UnaryCallSettings.Builder + batchTranslateTextSettings() { + return getStubSettingsBuilder().batchTranslateTextSettings(); + } + + /** Returns the builder for the settings used for calls to batchTranslateText. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationSettings() { + return getStubSettingsBuilder().batchTranslateTextOperationSettings(); + } + + /** Returns the builder for the settings used for calls to createGlossary. */ + public UnaryCallSettings.Builder createGlossarySettings() { + return getStubSettingsBuilder().createGlossarySettings(); + } + + /** Returns the builder for the settings used for calls to createGlossary. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createGlossaryOperationSettings() { + return getStubSettingsBuilder().createGlossaryOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listGlossaries. */ + public PagedCallSettings.Builder< + ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> + listGlossariesSettings() { + return getStubSettingsBuilder().listGlossariesSettings(); + } + + /** Returns the builder for the settings used for calls to getGlossary. */ + public UnaryCallSettings.Builder getGlossarySettings() { + return getStubSettingsBuilder().getGlossarySettings(); + } + + /** Returns the builder for the settings used for calls to deleteGlossary. */ + public UnaryCallSettings.Builder deleteGlossarySettings() { + return getStubSettingsBuilder().deleteGlossarySettings(); + } + + /** Returns the builder for the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return getStubSettingsBuilder().deleteGlossaryOperationSettings(); + } + + @Override + public TranslationServiceSettings build() throws IOException { + return new TranslationServiceSettings(this); + } + } +} diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/package-info.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/package-info.java new file mode 100644 index 00000000..a12e6add --- /dev/null +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/package-info.java @@ -0,0 +1,42 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A client to Cloud Translation API. + * + *

The interfaces provided are listed below, along with usage samples. + * + *

======================== TranslationServiceClient ======================== + * + *

Service Description: Provides natural language translation operations. + * + *

Sample for TranslationServiceClient: + * + *

+ * 
+ * try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
+ *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ *   String targetLanguageCode = "";
+ *   List<String> contents = new ArrayList<>();
+ *   TranslateTextResponse response = translationServiceClient.translateText(parent, targetLanguageCode, contents);
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.translate.v3; + +import javax.annotation.Generated; diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceCallableFactory.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceCallableFactory.java new file mode 100644 index 00000000..b13a240c --- /dev/null +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Cloud Translation API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcTranslationServiceCallableFactory implements GrpcStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceStub.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceStub.java new file mode 100644 index 00000000..bd915e6d --- /dev/null +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/GrpcTranslationServiceStub.java @@ -0,0 +1,460 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3.stub; + +import static com.google.cloud.translate.v3.TranslationServiceClient.ListGlossariesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.translate.v3.BatchTranslateMetadata; +import com.google.cloud.translate.v3.BatchTranslateResponse; +import com.google.cloud.translate.v3.BatchTranslateTextRequest; +import com.google.cloud.translate.v3.CreateGlossaryMetadata; +import com.google.cloud.translate.v3.CreateGlossaryRequest; +import com.google.cloud.translate.v3.DeleteGlossaryMetadata; +import com.google.cloud.translate.v3.DeleteGlossaryRequest; +import com.google.cloud.translate.v3.DeleteGlossaryResponse; +import com.google.cloud.translate.v3.DetectLanguageRequest; +import com.google.cloud.translate.v3.DetectLanguageResponse; +import com.google.cloud.translate.v3.GetGlossaryRequest; +import com.google.cloud.translate.v3.GetSupportedLanguagesRequest; +import com.google.cloud.translate.v3.Glossary; +import com.google.cloud.translate.v3.ListGlossariesRequest; +import com.google.cloud.translate.v3.ListGlossariesResponse; +import com.google.cloud.translate.v3.SupportedLanguages; +import com.google.cloud.translate.v3.TranslateTextRequest; +import com.google.cloud.translate.v3.TranslateTextResponse; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Cloud Translation API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcTranslationServiceStub extends TranslationServiceStub { + + private static final MethodDescriptor + translateTextMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.translation.v3.TranslationService/TranslateText") + .setRequestMarshaller( + ProtoUtils.marshaller(TranslateTextRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TranslateTextResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + detectLanguageMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.translation.v3.TranslationService/DetectLanguage") + .setRequestMarshaller( + ProtoUtils.marshaller(DetectLanguageRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(DetectLanguageResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getSupportedLanguagesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.translation.v3.TranslationService/GetSupportedLanguages") + .setRequestMarshaller( + ProtoUtils.marshaller(GetSupportedLanguagesRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(SupportedLanguages.getDefaultInstance())) + .build(); + private static final MethodDescriptor + batchTranslateTextMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.translation.v3.TranslationService/BatchTranslateText") + .setRequestMarshaller( + ProtoUtils.marshaller(BatchTranslateTextRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createGlossaryMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.translation.v3.TranslationService/CreateGlossary") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateGlossaryRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listGlossariesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.translation.v3.TranslationService/ListGlossaries") + .setRequestMarshaller( + ProtoUtils.marshaller(ListGlossariesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListGlossariesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor getGlossaryMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.translation.v3.TranslationService/GetGlossary") + .setRequestMarshaller(ProtoUtils.marshaller(GetGlossaryRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Glossary.getDefaultInstance())) + .build(); + private static final MethodDescriptor + deleteGlossaryMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.translation.v3.TranslationService/DeleteGlossary") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteGlossaryRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + + private final UnaryCallable translateTextCallable; + private final UnaryCallable detectLanguageCallable; + private final UnaryCallable + getSupportedLanguagesCallable; + private final UnaryCallable batchTranslateTextCallable; + private final OperationCallable< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationCallable; + private final UnaryCallable createGlossaryCallable; + private final OperationCallable + createGlossaryOperationCallable; + private final UnaryCallable listGlossariesCallable; + private final UnaryCallable + listGlossariesPagedCallable; + private final UnaryCallable getGlossaryCallable; + private final UnaryCallable deleteGlossaryCallable; + private final OperationCallable< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcTranslationServiceStub create(TranslationServiceStubSettings settings) + throws IOException { + return new GrpcTranslationServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcTranslationServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcTranslationServiceStub( + TranslationServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcTranslationServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcTranslationServiceStub( + TranslationServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcTranslationServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcTranslationServiceStub( + TranslationServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcTranslationServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcTranslationServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcTranslationServiceStub( + TranslationServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings translateTextTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(translateTextMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(TranslateTextRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + detectLanguageTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(detectLanguageMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DetectLanguageRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getSupportedLanguagesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getSupportedLanguagesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetSupportedLanguagesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings batchTranslateTextTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(batchTranslateTextMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(BatchTranslateTextRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings createGlossaryTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createGlossaryMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateGlossaryRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listGlossariesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listGlossariesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListGlossariesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getGlossaryTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getGlossaryMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetGlossaryRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteGlossaryTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteGlossaryMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteGlossaryRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + + this.translateTextCallable = + callableFactory.createUnaryCallable( + translateTextTransportSettings, settings.translateTextSettings(), clientContext); + this.detectLanguageCallable = + callableFactory.createUnaryCallable( + detectLanguageTransportSettings, settings.detectLanguageSettings(), clientContext); + this.getSupportedLanguagesCallable = + callableFactory.createUnaryCallable( + getSupportedLanguagesTransportSettings, + settings.getSupportedLanguagesSettings(), + clientContext); + this.batchTranslateTextCallable = + callableFactory.createUnaryCallable( + batchTranslateTextTransportSettings, + settings.batchTranslateTextSettings(), + clientContext); + this.batchTranslateTextOperationCallable = + callableFactory.createOperationCallable( + batchTranslateTextTransportSettings, + settings.batchTranslateTextOperationSettings(), + clientContext, + this.operationsStub); + this.createGlossaryCallable = + callableFactory.createUnaryCallable( + createGlossaryTransportSettings, settings.createGlossarySettings(), clientContext); + this.createGlossaryOperationCallable = + callableFactory.createOperationCallable( + createGlossaryTransportSettings, + settings.createGlossaryOperationSettings(), + clientContext, + this.operationsStub); + this.listGlossariesCallable = + callableFactory.createUnaryCallable( + listGlossariesTransportSettings, settings.listGlossariesSettings(), clientContext); + this.listGlossariesPagedCallable = + callableFactory.createPagedCallable( + listGlossariesTransportSettings, settings.listGlossariesSettings(), clientContext); + this.getGlossaryCallable = + callableFactory.createUnaryCallable( + getGlossaryTransportSettings, settings.getGlossarySettings(), clientContext); + this.deleteGlossaryCallable = + callableFactory.createUnaryCallable( + deleteGlossaryTransportSettings, settings.deleteGlossarySettings(), clientContext); + this.deleteGlossaryOperationCallable = + callableFactory.createOperationCallable( + deleteGlossaryTransportSettings, + settings.deleteGlossaryOperationSettings(), + clientContext, + this.operationsStub); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + public UnaryCallable translateTextCallable() { + return translateTextCallable; + } + + public UnaryCallable detectLanguageCallable() { + return detectLanguageCallable; + } + + public UnaryCallable + getSupportedLanguagesCallable() { + return getSupportedLanguagesCallable; + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationCallable() { + return batchTranslateTextOperationCallable; + } + + public UnaryCallable batchTranslateTextCallable() { + return batchTranslateTextCallable; + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + createGlossaryOperationCallable() { + return createGlossaryOperationCallable; + } + + public UnaryCallable createGlossaryCallable() { + return createGlossaryCallable; + } + + public UnaryCallable + listGlossariesPagedCallable() { + return listGlossariesPagedCallable; + } + + public UnaryCallable listGlossariesCallable() { + return listGlossariesCallable; + } + + public UnaryCallable getGlossaryCallable() { + return getGlossaryCallable; + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + deleteGlossaryOperationCallable() { + return deleteGlossaryOperationCallable; + } + + public UnaryCallable deleteGlossaryCallable() { + return deleteGlossaryCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStub.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStub.java new file mode 100644 index 00000000..692a0739 --- /dev/null +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStub.java @@ -0,0 +1,121 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3.stub; + +import static com.google.cloud.translate.v3.TranslationServiceClient.ListGlossariesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.translate.v3.BatchTranslateMetadata; +import com.google.cloud.translate.v3.BatchTranslateResponse; +import com.google.cloud.translate.v3.BatchTranslateTextRequest; +import com.google.cloud.translate.v3.CreateGlossaryMetadata; +import com.google.cloud.translate.v3.CreateGlossaryRequest; +import com.google.cloud.translate.v3.DeleteGlossaryMetadata; +import com.google.cloud.translate.v3.DeleteGlossaryRequest; +import com.google.cloud.translate.v3.DeleteGlossaryResponse; +import com.google.cloud.translate.v3.DetectLanguageRequest; +import com.google.cloud.translate.v3.DetectLanguageResponse; +import com.google.cloud.translate.v3.GetGlossaryRequest; +import com.google.cloud.translate.v3.GetSupportedLanguagesRequest; +import com.google.cloud.translate.v3.Glossary; +import com.google.cloud.translate.v3.ListGlossariesRequest; +import com.google.cloud.translate.v3.ListGlossariesResponse; +import com.google.cloud.translate.v3.SupportedLanguages; +import com.google.cloud.translate.v3.TranslateTextRequest; +import com.google.cloud.translate.v3.TranslateTextResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Cloud Translation API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class TranslationServiceStub implements BackgroundResource { + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationsStub getOperationsStub() { + throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + } + + public UnaryCallable translateTextCallable() { + throw new UnsupportedOperationException("Not implemented: translateTextCallable()"); + } + + public UnaryCallable detectLanguageCallable() { + throw new UnsupportedOperationException("Not implemented: detectLanguageCallable()"); + } + + public UnaryCallable + getSupportedLanguagesCallable() { + throw new UnsupportedOperationException("Not implemented: getSupportedLanguagesCallable()"); + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: batchTranslateTextOperationCallable()"); + } + + public UnaryCallable batchTranslateTextCallable() { + throw new UnsupportedOperationException("Not implemented: batchTranslateTextCallable()"); + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + createGlossaryOperationCallable() { + throw new UnsupportedOperationException("Not implemented: createGlossaryOperationCallable()"); + } + + public UnaryCallable createGlossaryCallable() { + throw new UnsupportedOperationException("Not implemented: createGlossaryCallable()"); + } + + public UnaryCallable + listGlossariesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listGlossariesPagedCallable()"); + } + + public UnaryCallable listGlossariesCallable() { + throw new UnsupportedOperationException("Not implemented: listGlossariesCallable()"); + } + + public UnaryCallable getGlossaryCallable() { + throw new UnsupportedOperationException("Not implemented: getGlossaryCallable()"); + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + deleteGlossaryOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGlossaryOperationCallable()"); + } + + public UnaryCallable deleteGlossaryCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGlossaryCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStubSettings.java b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStubSettings.java new file mode 100644 index 00000000..fc33f594 --- /dev/null +++ b/google-cloud-translate/src/main/java/com/google/cloud/translate/v3/stub/TranslationServiceStubSettings.java @@ -0,0 +1,688 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3.stub; + +import static com.google.cloud.translate.v3.TranslationServiceClient.ListGlossariesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.translate.v3.BatchTranslateMetadata; +import com.google.cloud.translate.v3.BatchTranslateResponse; +import com.google.cloud.translate.v3.BatchTranslateTextRequest; +import com.google.cloud.translate.v3.CreateGlossaryMetadata; +import com.google.cloud.translate.v3.CreateGlossaryRequest; +import com.google.cloud.translate.v3.DeleteGlossaryMetadata; +import com.google.cloud.translate.v3.DeleteGlossaryRequest; +import com.google.cloud.translate.v3.DeleteGlossaryResponse; +import com.google.cloud.translate.v3.DetectLanguageRequest; +import com.google.cloud.translate.v3.DetectLanguageResponse; +import com.google.cloud.translate.v3.GetGlossaryRequest; +import com.google.cloud.translate.v3.GetSupportedLanguagesRequest; +import com.google.cloud.translate.v3.Glossary; +import com.google.cloud.translate.v3.ListGlossariesRequest; +import com.google.cloud.translate.v3.ListGlossariesResponse; +import com.google.cloud.translate.v3.SupportedLanguages; +import com.google.cloud.translate.v3.TranslateTextRequest; +import com.google.cloud.translate.v3.TranslateTextResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link TranslationServiceStub}. + * + *

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 total timeout of translateText to 30 seconds: + * + *

+ * 
+ * TranslationServiceStubSettings.Builder translationServiceSettingsBuilder =
+ *     TranslationServiceStubSettings.newBuilder();
+ * translationServiceSettingsBuilder.translateTextSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * TranslationServiceStubSettings translationServiceSettings = translationServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class TranslationServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/cloud-translation") + .build(); + + private final UnaryCallSettings + translateTextSettings; + private final UnaryCallSettings + detectLanguageSettings; + private final UnaryCallSettings + getSupportedLanguagesSettings; + private final UnaryCallSettings batchTranslateTextSettings; + private final OperationCallSettings< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationSettings; + private final UnaryCallSettings createGlossarySettings; + private final OperationCallSettings + createGlossaryOperationSettings; + private final PagedCallSettings< + ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> + listGlossariesSettings; + private final UnaryCallSettings getGlossarySettings; + private final UnaryCallSettings deleteGlossarySettings; + private final OperationCallSettings< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings; + + /** Returns the object with the settings used for calls to translateText. */ + public UnaryCallSettings translateTextSettings() { + return translateTextSettings; + } + + /** Returns the object with the settings used for calls to detectLanguage. */ + public UnaryCallSettings detectLanguageSettings() { + return detectLanguageSettings; + } + + /** Returns the object with the settings used for calls to getSupportedLanguages. */ + public UnaryCallSettings + getSupportedLanguagesSettings() { + return getSupportedLanguagesSettings; + } + + /** Returns the object with the settings used for calls to batchTranslateText. */ + public UnaryCallSettings batchTranslateTextSettings() { + return batchTranslateTextSettings; + } + + /** Returns the object with the settings used for calls to batchTranslateText. */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationSettings() { + return batchTranslateTextOperationSettings; + } + + /** Returns the object with the settings used for calls to createGlossary. */ + public UnaryCallSettings createGlossarySettings() { + return createGlossarySettings; + } + + /** Returns the object with the settings used for calls to createGlossary. */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings + createGlossaryOperationSettings() { + return createGlossaryOperationSettings; + } + + /** Returns the object with the settings used for calls to listGlossaries. */ + public PagedCallSettings< + ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> + listGlossariesSettings() { + return listGlossariesSettings; + } + + /** Returns the object with the settings used for calls to getGlossary. */ + public UnaryCallSettings getGlossarySettings() { + return getGlossarySettings; + } + + /** Returns the object with the settings used for calls to deleteGlossary. */ + public UnaryCallSettings deleteGlossarySettings() { + return deleteGlossarySettings; + } + + /** Returns the object with the settings used for calls to deleteGlossary. */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return deleteGlossaryOperationSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public TranslationServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcTranslationServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "translate.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(TranslationServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TranslationServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + translateTextSettings = settingsBuilder.translateTextSettings().build(); + detectLanguageSettings = settingsBuilder.detectLanguageSettings().build(); + getSupportedLanguagesSettings = settingsBuilder.getSupportedLanguagesSettings().build(); + batchTranslateTextSettings = settingsBuilder.batchTranslateTextSettings().build(); + batchTranslateTextOperationSettings = + settingsBuilder.batchTranslateTextOperationSettings().build(); + createGlossarySettings = settingsBuilder.createGlossarySettings().build(); + createGlossaryOperationSettings = settingsBuilder.createGlossaryOperationSettings().build(); + listGlossariesSettings = settingsBuilder.listGlossariesSettings().build(); + getGlossarySettings = settingsBuilder.getGlossarySettings().build(); + deleteGlossarySettings = settingsBuilder.deleteGlossarySettings().build(); + deleteGlossaryOperationSettings = settingsBuilder.deleteGlossaryOperationSettings().build(); + } + + private static final PagedListDescriptor + LIST_GLOSSARIES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListGlossariesRequest injectToken(ListGlossariesRequest payload, String token) { + return ListGlossariesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListGlossariesRequest injectPageSize( + ListGlossariesRequest payload, int pageSize) { + return ListGlossariesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListGlossariesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListGlossariesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListGlossariesResponse payload) { + return payload.getGlossariesList() != null + ? payload.getGlossariesList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> + LIST_GLOSSARIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListGlossariesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_GLOSSARIES_PAGE_STR_DESC, request, context); + return ListGlossariesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for TranslationServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + translateTextSettings; + private final UnaryCallSettings.Builder + detectLanguageSettings; + private final UnaryCallSettings.Builder + getSupportedLanguagesSettings; + private final UnaryCallSettings.Builder + batchTranslateTextSettings; + private final OperationCallSettings.Builder< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationSettings; + private final UnaryCallSettings.Builder + createGlossarySettings; + private final OperationCallSettings.Builder< + CreateGlossaryRequest, Glossary, CreateGlossaryMetadata> + createGlossaryOperationSettings; + private final PagedCallSettings.Builder< + ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> + listGlossariesSettings; + private final UnaryCallSettings.Builder getGlossarySettings; + private final UnaryCallSettings.Builder + deleteGlossarySettings; + private final OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + translateTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + detectLanguageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getSupportedLanguagesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + batchTranslateTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + batchTranslateTextOperationSettings = OperationCallSettings.newBuilder(); + + createGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createGlossaryOperationSettings = OperationCallSettings.newBuilder(); + + listGlossariesSettings = PagedCallSettings.newBuilder(LIST_GLOSSARIES_PAGE_STR_FACT); + + getGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteGlossarySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteGlossaryOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + translateTextSettings, + detectLanguageSettings, + getSupportedLanguagesSettings, + batchTranslateTextSettings, + createGlossarySettings, + listGlossariesSettings, + getGlossarySettings, + deleteGlossarySettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .translateTextSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .detectLanguageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getSupportedLanguagesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .batchTranslateTextSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createGlossarySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listGlossariesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getGlossarySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteGlossarySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder + .batchTranslateTextOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(BatchTranslateResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(BatchTranslateMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(500L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(5000L)) + .setInitialRpcTimeout(Duration.ZERO) // ignored + .setRpcTimeoutMultiplier(1.0) // ignored + .setMaxRpcTimeout(Duration.ZERO) // ignored + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + builder + .createGlossaryOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Glossary.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(CreateGlossaryMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(500L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(5000L)) + .setInitialRpcTimeout(Duration.ZERO) // ignored + .setRpcTimeoutMultiplier(1.0) // ignored + .setMaxRpcTimeout(Duration.ZERO) // ignored + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + builder + .deleteGlossaryOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(DeleteGlossaryResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(DeleteGlossaryMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(500L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(5000L)) + .setInitialRpcTimeout(Duration.ZERO) // ignored + .setRpcTimeoutMultiplier(1.0) // ignored + .setMaxRpcTimeout(Duration.ZERO) // ignored + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + protected Builder(TranslationServiceStubSettings settings) { + super(settings); + + translateTextSettings = settings.translateTextSettings.toBuilder(); + detectLanguageSettings = settings.detectLanguageSettings.toBuilder(); + getSupportedLanguagesSettings = settings.getSupportedLanguagesSettings.toBuilder(); + batchTranslateTextSettings = settings.batchTranslateTextSettings.toBuilder(); + batchTranslateTextOperationSettings = + settings.batchTranslateTextOperationSettings.toBuilder(); + createGlossarySettings = settings.createGlossarySettings.toBuilder(); + createGlossaryOperationSettings = settings.createGlossaryOperationSettings.toBuilder(); + listGlossariesSettings = settings.listGlossariesSettings.toBuilder(); + getGlossarySettings = settings.getGlossarySettings.toBuilder(); + deleteGlossarySettings = settings.deleteGlossarySettings.toBuilder(); + deleteGlossaryOperationSettings = settings.deleteGlossaryOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + translateTextSettings, + detectLanguageSettings, + getSupportedLanguagesSettings, + batchTranslateTextSettings, + createGlossarySettings, + listGlossariesSettings, + getGlossarySettings, + deleteGlossarySettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to translateText. */ + public UnaryCallSettings.Builder + translateTextSettings() { + return translateTextSettings; + } + + /** Returns the builder for the settings used for calls to detectLanguage. */ + public UnaryCallSettings.Builder + detectLanguageSettings() { + return detectLanguageSettings; + } + + /** Returns the builder for the settings used for calls to getSupportedLanguages. */ + public UnaryCallSettings.Builder + getSupportedLanguagesSettings() { + return getSupportedLanguagesSettings; + } + + /** Returns the builder for the settings used for calls to batchTranslateText. */ + public UnaryCallSettings.Builder + batchTranslateTextSettings() { + return batchTranslateTextSettings; + } + + /** Returns the builder for the settings used for calls to batchTranslateText. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> + batchTranslateTextOperationSettings() { + return batchTranslateTextOperationSettings; + } + + /** Returns the builder for the settings used for calls to createGlossary. */ + public UnaryCallSettings.Builder createGlossarySettings() { + return createGlossarySettings; + } + + /** Returns the builder for the settings used for calls to createGlossary. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createGlossaryOperationSettings() { + return createGlossaryOperationSettings; + } + + /** Returns the builder for the settings used for calls to listGlossaries. */ + public PagedCallSettings.Builder< + ListGlossariesRequest, ListGlossariesResponse, ListGlossariesPagedResponse> + listGlossariesSettings() { + return listGlossariesSettings; + } + + /** Returns the builder for the settings used for calls to getGlossary. */ + public UnaryCallSettings.Builder getGlossarySettings() { + return getGlossarySettings; + } + + /** Returns the builder for the settings used for calls to deleteGlossary. */ + public UnaryCallSettings.Builder deleteGlossarySettings() { + return deleteGlossarySettings; + } + + /** Returns the builder for the settings used for calls to deleteGlossary. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> + deleteGlossaryOperationSettings() { + return deleteGlossaryOperationSettings; + } + + @Override + public TranslationServiceStubSettings build() throws IOException { + return new TranslationServiceStubSettings(this); + } + } +} diff --git a/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/MockTranslationService.java b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/MockTranslationService.java new file mode 100644 index 00000000..e88269e3 --- /dev/null +++ b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/MockTranslationService.java @@ -0,0 +1,57 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockTranslationService implements MockGrpcService { + private final MockTranslationServiceImpl serviceImpl; + + public MockTranslationService() { + serviceImpl = new MockTranslationServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/MockTranslationServiceImpl.java b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/MockTranslationServiceImpl.java new file mode 100644 index 00000000..63d4b1f4 --- /dev/null +++ b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/MockTranslationServiceImpl.java @@ -0,0 +1,178 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3; + +import com.google.api.core.BetaApi; +import com.google.cloud.translate.v3.TranslationServiceGrpc.TranslationServiceImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockTranslationServiceImpl extends TranslationServiceImplBase { + private List requests; + private Queue responses; + + public MockTranslationServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void translateText( + TranslateTextRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof TranslateTextResponse) { + requests.add(request); + responseObserver.onNext((TranslateTextResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void detectLanguage( + DetectLanguageRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof DetectLanguageResponse) { + requests.add(request); + responseObserver.onNext((DetectLanguageResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getSupportedLanguages( + GetSupportedLanguagesRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof SupportedLanguages) { + requests.add(request); + responseObserver.onNext((SupportedLanguages) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void batchTranslateText( + BatchTranslateTextRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext((Operation) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createGlossary( + CreateGlossaryRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext((Operation) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listGlossaries( + ListGlossariesRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListGlossariesResponse) { + requests.add(request); + responseObserver.onNext((ListGlossariesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getGlossary(GetGlossaryRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Glossary) { + requests.add(request); + responseObserver.onNext((Glossary) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteGlossary( + DeleteGlossaryRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext((Operation) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/TranslationServiceClientTest.java b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/TranslationServiceClientTest.java new file mode 100644 index 00000000..c6fe7eac --- /dev/null +++ b/google-cloud-translate/src/test/java/com/google/cloud/translate/v3/TranslationServiceClientTest.java @@ -0,0 +1,466 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3; + +import static com.google.cloud.translate.v3.TranslationServiceClient.ListGlossariesPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutionException; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class TranslationServiceClientTest { + private static MockTranslationService mockTranslationService; + private static MockServiceHelper serviceHelper; + private TranslationServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockTranslationService = new MockTranslationService(); + serviceHelper = + new MockServiceHelper( + "in-process-1", Arrays.asList(mockTranslationService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + TranslationServiceSettings settings = + TranslationServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TranslationServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void translateTextTest() { + TranslateTextResponse expectedResponse = TranslateTextResponse.newBuilder().build(); + mockTranslationService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String targetLanguageCode = "targetLanguageCode1323228230"; + List contents = new ArrayList<>(); + + TranslateTextResponse actualResponse = + client.translateText(parent, targetLanguageCode, contents); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TranslateTextRequest actualRequest = (TranslateTextRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(targetLanguageCode, actualRequest.getTargetLanguageCode()); + Assert.assertEquals(contents, actualRequest.getContentsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void translateTextExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String targetLanguageCode = "targetLanguageCode1323228230"; + List contents = new ArrayList<>(); + + client.translateText(parent, targetLanguageCode, contents); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void translateTextTest2() { + TranslateTextResponse expectedResponse = TranslateTextResponse.newBuilder().build(); + mockTranslationService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String model = "model104069929"; + String mimeType = "mimeType-196041627"; + String sourceLanguageCode = "sourceLanguageCode1687263568"; + String targetLanguageCode = "targetLanguageCode1323228230"; + List contents = new ArrayList<>(); + + TranslateTextResponse actualResponse = + client.translateText( + parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TranslateTextRequest actualRequest = (TranslateTextRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(model, actualRequest.getModel()); + Assert.assertEquals(mimeType, actualRequest.getMimeType()); + Assert.assertEquals(sourceLanguageCode, actualRequest.getSourceLanguageCode()); + Assert.assertEquals(targetLanguageCode, actualRequest.getTargetLanguageCode()); + Assert.assertEquals(contents, actualRequest.getContentsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void translateTextExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String model = "model104069929"; + String mimeType = "mimeType-196041627"; + String sourceLanguageCode = "sourceLanguageCode1687263568"; + String targetLanguageCode = "targetLanguageCode1323228230"; + List contents = new ArrayList<>(); + + client.translateText( + parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void detectLanguageTest() { + DetectLanguageResponse expectedResponse = DetectLanguageResponse.newBuilder().build(); + mockTranslationService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String model = "model104069929"; + String mimeType = "mimeType-196041627"; + String content = "content951530617"; + + DetectLanguageResponse actualResponse = client.detectLanguage(parent, model, mimeType, content); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DetectLanguageRequest actualRequest = (DetectLanguageRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(model, actualRequest.getModel()); + Assert.assertEquals(mimeType, actualRequest.getMimeType()); + Assert.assertEquals(content, actualRequest.getContent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void detectLanguageExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String model = "model104069929"; + String mimeType = "mimeType-196041627"; + String content = "content951530617"; + + client.detectLanguage(parent, model, mimeType, content); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getSupportedLanguagesTest() { + SupportedLanguages expectedResponse = SupportedLanguages.newBuilder().build(); + mockTranslationService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String model = "model104069929"; + String displayLanguageCode = "displayLanguageCode30710199"; + + SupportedLanguages actualResponse = + client.getSupportedLanguages(parent, model, displayLanguageCode); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSupportedLanguagesRequest actualRequest = + (GetSupportedLanguagesRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(model, actualRequest.getModel()); + Assert.assertEquals(displayLanguageCode, actualRequest.getDisplayLanguageCode()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getSupportedLanguagesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String model = "model104069929"; + String displayLanguageCode = "displayLanguageCode30710199"; + + client.getSupportedLanguages(parent, model, displayLanguageCode); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createGlossaryTest() throws Exception { + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + int entryCount = 811131134; + Glossary expectedResponse = + Glossary.newBuilder().setName(name.toString()).setEntryCount(entryCount).build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createGlossaryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockTranslationService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Glossary glossary = Glossary.newBuilder().build(); + + Glossary actualResponse = client.createGlossaryAsync(parent, glossary).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateGlossaryRequest actualRequest = (CreateGlossaryRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(glossary, actualRequest.getGlossary()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createGlossaryExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Glossary glossary = Glossary.newBuilder().build(); + + client.createGlossaryAsync(parent, glossary).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + @SuppressWarnings("all") + public void listGlossariesTest() { + String nextPageToken = ""; + Glossary glossariesElement = Glossary.newBuilder().build(); + List glossaries = Arrays.asList(glossariesElement); + ListGlossariesResponse expectedResponse = + ListGlossariesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllGlossaries(glossaries) + .build(); + mockTranslationService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListGlossariesPagedResponse pagedListResponse = client.listGlossaries(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getGlossariesList().get(0), resources.get(0)); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListGlossariesRequest actualRequest = (ListGlossariesRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listGlossariesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + client.listGlossaries(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getGlossaryTest() { + GlossaryName name2 = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + int entryCount = 811131134; + Glossary expectedResponse = + Glossary.newBuilder().setName(name2.toString()).setEntryCount(entryCount).build(); + mockTranslationService.addResponse(expectedResponse); + + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + + Glossary actualResponse = client.getGlossary(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetGlossaryRequest actualRequest = (GetGlossaryRequest) actualRequests.get(0); + + Assert.assertEquals(name, GlossaryName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getGlossaryExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + + client.getGlossary(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteGlossaryTest() throws Exception { + String name2 = "name2-1052831874"; + DeleteGlossaryResponse expectedResponse = + DeleteGlossaryResponse.newBuilder().setName(name2).build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteGlossaryTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockTranslationService.addResponse(resultOperation); + + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + + DeleteGlossaryResponse actualResponse = client.deleteGlossaryAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTranslationService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteGlossaryRequest actualRequest = (DeleteGlossaryRequest) actualRequests.get(0); + + Assert.assertEquals(name, GlossaryName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteGlossaryExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockTranslationService.addException(exception); + + try { + GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]"); + + client.deleteGlossaryAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/grpc-google-cloud-translate-v3/pom.xml b/grpc-google-cloud-translate-v3/pom.xml new file mode 100644 index 00000000..2833e765 --- /dev/null +++ b/grpc-google-cloud-translate-v3/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-translate-v3 + 0.76.1-SNAPSHOT + grpc-google-cloud-translate-v3 + GRPC library for grpc-google-cloud-translate-v3 + + com.google.cloud + google-cloud-translate-parent + 1.93.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-cloud-translate-v3 + + + com.google.api.grpc + proto-google-common-protos + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/grpc-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationServiceGrpc.java b/grpc-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationServiceGrpc.java new file mode 100644 index 00000000..13e2509b --- /dev/null +++ b/grpc-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationServiceGrpc.java @@ -0,0 +1,1298 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.translate.v3; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * Provides natural language translation operations.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler (version 1.10.0)", + comments = "Source: google/cloud/translate/v3/translation_service.proto") +public final class TranslationServiceGrpc { + + private TranslationServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.translation.v3.TranslationService"; + + // Static method descriptors that strictly reflect the proto. + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getTranslateTextMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.TranslateTextRequest, + com.google.cloud.translate.v3.TranslateTextResponse> + METHOD_TRANSLATE_TEXT = getTranslateTextMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.TranslateTextRequest, + com.google.cloud.translate.v3.TranslateTextResponse> + getTranslateTextMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.TranslateTextRequest, + com.google.cloud.translate.v3.TranslateTextResponse> + getTranslateTextMethod() { + return getTranslateTextMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.TranslateTextRequest, + com.google.cloud.translate.v3.TranslateTextResponse> + getTranslateTextMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.TranslateTextRequest, + com.google.cloud.translate.v3.TranslateTextResponse> + getTranslateTextMethod; + if ((getTranslateTextMethod = TranslationServiceGrpc.getTranslateTextMethod) == null) { + synchronized (TranslationServiceGrpc.class) { + if ((getTranslateTextMethod = TranslationServiceGrpc.getTranslateTextMethod) == null) { + TranslationServiceGrpc.getTranslateTextMethod = + getTranslateTextMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.translation.v3.TranslationService", "TranslateText")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.TranslateTextRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.TranslateTextResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new TranslationServiceMethodDescriptorSupplier("TranslateText")) + .build(); + } + } + } + return getTranslateTextMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getDetectLanguageMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DetectLanguageRequest, + com.google.cloud.translate.v3.DetectLanguageResponse> + METHOD_DETECT_LANGUAGE = getDetectLanguageMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DetectLanguageRequest, + com.google.cloud.translate.v3.DetectLanguageResponse> + getDetectLanguageMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DetectLanguageRequest, + com.google.cloud.translate.v3.DetectLanguageResponse> + getDetectLanguageMethod() { + return getDetectLanguageMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DetectLanguageRequest, + com.google.cloud.translate.v3.DetectLanguageResponse> + getDetectLanguageMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DetectLanguageRequest, + com.google.cloud.translate.v3.DetectLanguageResponse> + getDetectLanguageMethod; + if ((getDetectLanguageMethod = TranslationServiceGrpc.getDetectLanguageMethod) == null) { + synchronized (TranslationServiceGrpc.class) { + if ((getDetectLanguageMethod = TranslationServiceGrpc.getDetectLanguageMethod) == null) { + TranslationServiceGrpc.getDetectLanguageMethod = + getDetectLanguageMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.translation.v3.TranslationService", "DetectLanguage")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.DetectLanguageRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.DetectLanguageResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new TranslationServiceMethodDescriptorSupplier("DetectLanguage")) + .build(); + } + } + } + return getDetectLanguageMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getGetSupportedLanguagesMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetSupportedLanguagesRequest, + com.google.cloud.translate.v3.SupportedLanguages> + METHOD_GET_SUPPORTED_LANGUAGES = getGetSupportedLanguagesMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetSupportedLanguagesRequest, + com.google.cloud.translate.v3.SupportedLanguages> + getGetSupportedLanguagesMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetSupportedLanguagesRequest, + com.google.cloud.translate.v3.SupportedLanguages> + getGetSupportedLanguagesMethod() { + return getGetSupportedLanguagesMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetSupportedLanguagesRequest, + com.google.cloud.translate.v3.SupportedLanguages> + getGetSupportedLanguagesMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetSupportedLanguagesRequest, + com.google.cloud.translate.v3.SupportedLanguages> + getGetSupportedLanguagesMethod; + if ((getGetSupportedLanguagesMethod = TranslationServiceGrpc.getGetSupportedLanguagesMethod) + == null) { + synchronized (TranslationServiceGrpc.class) { + if ((getGetSupportedLanguagesMethod = TranslationServiceGrpc.getGetSupportedLanguagesMethod) + == null) { + TranslationServiceGrpc.getGetSupportedLanguagesMethod = + getGetSupportedLanguagesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.translation.v3.TranslationService", + "GetSupportedLanguages")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.GetSupportedLanguagesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.SupportedLanguages + .getDefaultInstance())) + .setSchemaDescriptor( + new TranslationServiceMethodDescriptorSupplier("GetSupportedLanguages")) + .build(); + } + } + } + return getGetSupportedLanguagesMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getBatchTranslateTextMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.BatchTranslateTextRequest, com.google.longrunning.Operation> + METHOD_BATCH_TRANSLATE_TEXT = getBatchTranslateTextMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.BatchTranslateTextRequest, com.google.longrunning.Operation> + getBatchTranslateTextMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.BatchTranslateTextRequest, com.google.longrunning.Operation> + getBatchTranslateTextMethod() { + return getBatchTranslateTextMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.BatchTranslateTextRequest, com.google.longrunning.Operation> + getBatchTranslateTextMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.BatchTranslateTextRequest, + com.google.longrunning.Operation> + getBatchTranslateTextMethod; + if ((getBatchTranslateTextMethod = TranslationServiceGrpc.getBatchTranslateTextMethod) + == null) { + synchronized (TranslationServiceGrpc.class) { + if ((getBatchTranslateTextMethod = TranslationServiceGrpc.getBatchTranslateTextMethod) + == null) { + TranslationServiceGrpc.getBatchTranslateTextMethod = + getBatchTranslateTextMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.translation.v3.TranslationService", + "BatchTranslateText")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.BatchTranslateTextRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new TranslationServiceMethodDescriptorSupplier("BatchTranslateText")) + .build(); + } + } + } + return getBatchTranslateTextMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getCreateGlossaryMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.CreateGlossaryRequest, com.google.longrunning.Operation> + METHOD_CREATE_GLOSSARY = getCreateGlossaryMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.CreateGlossaryRequest, com.google.longrunning.Operation> + getCreateGlossaryMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.CreateGlossaryRequest, com.google.longrunning.Operation> + getCreateGlossaryMethod() { + return getCreateGlossaryMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.CreateGlossaryRequest, com.google.longrunning.Operation> + getCreateGlossaryMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.CreateGlossaryRequest, com.google.longrunning.Operation> + getCreateGlossaryMethod; + if ((getCreateGlossaryMethod = TranslationServiceGrpc.getCreateGlossaryMethod) == null) { + synchronized (TranslationServiceGrpc.class) { + if ((getCreateGlossaryMethod = TranslationServiceGrpc.getCreateGlossaryMethod) == null) { + TranslationServiceGrpc.getCreateGlossaryMethod = + getCreateGlossaryMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.translation.v3.TranslationService", "CreateGlossary")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.CreateGlossaryRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new TranslationServiceMethodDescriptorSupplier("CreateGlossary")) + .build(); + } + } + } + return getCreateGlossaryMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getListGlossariesMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.ListGlossariesRequest, + com.google.cloud.translate.v3.ListGlossariesResponse> + METHOD_LIST_GLOSSARIES = getListGlossariesMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.ListGlossariesRequest, + com.google.cloud.translate.v3.ListGlossariesResponse> + getListGlossariesMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.ListGlossariesRequest, + com.google.cloud.translate.v3.ListGlossariesResponse> + getListGlossariesMethod() { + return getListGlossariesMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.ListGlossariesRequest, + com.google.cloud.translate.v3.ListGlossariesResponse> + getListGlossariesMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.ListGlossariesRequest, + com.google.cloud.translate.v3.ListGlossariesResponse> + getListGlossariesMethod; + if ((getListGlossariesMethod = TranslationServiceGrpc.getListGlossariesMethod) == null) { + synchronized (TranslationServiceGrpc.class) { + if ((getListGlossariesMethod = TranslationServiceGrpc.getListGlossariesMethod) == null) { + TranslationServiceGrpc.getListGlossariesMethod = + getListGlossariesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.translation.v3.TranslationService", "ListGlossaries")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.ListGlossariesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.ListGlossariesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new TranslationServiceMethodDescriptorSupplier("ListGlossaries")) + .build(); + } + } + } + return getListGlossariesMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getGetGlossaryMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetGlossaryRequest, com.google.cloud.translate.v3.Glossary> + METHOD_GET_GLOSSARY = getGetGlossaryMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetGlossaryRequest, com.google.cloud.translate.v3.Glossary> + getGetGlossaryMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetGlossaryRequest, com.google.cloud.translate.v3.Glossary> + getGetGlossaryMethod() { + return getGetGlossaryMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetGlossaryRequest, com.google.cloud.translate.v3.Glossary> + getGetGlossaryMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.GetGlossaryRequest, + com.google.cloud.translate.v3.Glossary> + getGetGlossaryMethod; + if ((getGetGlossaryMethod = TranslationServiceGrpc.getGetGlossaryMethod) == null) { + synchronized (TranslationServiceGrpc.class) { + if ((getGetGlossaryMethod = TranslationServiceGrpc.getGetGlossaryMethod) == null) { + TranslationServiceGrpc.getGetGlossaryMethod = + getGetGlossaryMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.translation.v3.TranslationService", "GetGlossary")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.GetGlossaryRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.Glossary.getDefaultInstance())) + .setSchemaDescriptor( + new TranslationServiceMethodDescriptorSupplier("GetGlossary")) + .build(); + } + } + } + return getGetGlossaryMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getDeleteGlossaryMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DeleteGlossaryRequest, com.google.longrunning.Operation> + METHOD_DELETE_GLOSSARY = getDeleteGlossaryMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DeleteGlossaryRequest, com.google.longrunning.Operation> + getDeleteGlossaryMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DeleteGlossaryRequest, com.google.longrunning.Operation> + getDeleteGlossaryMethod() { + return getDeleteGlossaryMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DeleteGlossaryRequest, com.google.longrunning.Operation> + getDeleteGlossaryMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.translate.v3.DeleteGlossaryRequest, com.google.longrunning.Operation> + getDeleteGlossaryMethod; + if ((getDeleteGlossaryMethod = TranslationServiceGrpc.getDeleteGlossaryMethod) == null) { + synchronized (TranslationServiceGrpc.class) { + if ((getDeleteGlossaryMethod = TranslationServiceGrpc.getDeleteGlossaryMethod) == null) { + TranslationServiceGrpc.getDeleteGlossaryMethod = + getDeleteGlossaryMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.translation.v3.TranslationService", "DeleteGlossary")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.translate.v3.DeleteGlossaryRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new TranslationServiceMethodDescriptorSupplier("DeleteGlossary")) + .build(); + } + } + } + return getDeleteGlossaryMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static TranslationServiceStub newStub(io.grpc.Channel channel) { + return new TranslationServiceStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static TranslationServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + return new TranslationServiceBlockingStub(channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static TranslationServiceFutureStub newFutureStub(io.grpc.Channel channel) { + return new TranslationServiceFutureStub(channel); + } + + /** + * + * + *
+   * Provides natural language translation operations.
+   * 
+ */ + public abstract static class TranslationServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Translates input text and returns translated text.
+     * 
+ */ + public void translateText( + com.google.cloud.translate.v3.TranslateTextRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getTranslateTextMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Detects the language of text within a request.
+     * 
+ */ + public void detectLanguage( + com.google.cloud.translate.v3.DetectLanguageRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getDetectLanguageMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Returns a list of supported languages for translation.
+     * 
+ */ + public void getSupportedLanguages( + com.google.cloud.translate.v3.GetSupportedLanguagesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getGetSupportedLanguagesMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Translates a large volume of text in asynchronous batch mode.
+     * This function provides real-time output as the inputs are being processed.
+     * If caller cancels a request, the partial results (for an input file, it's
+     * all or nothing) may still be available on the specified output location.
+     * This call returns immediately and you can
+     * use google.longrunning.Operation.name to poll the status of the call.
+     * 
+ */ + public void batchTranslateText( + com.google.cloud.translate.v3.BatchTranslateTextRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getBatchTranslateTextMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Creates a glossary and returns the long-running operation. Returns
+     * NOT_FOUND, if the project doesn't exist.
+     * 
+ */ + public void createGlossary( + com.google.cloud.translate.v3.CreateGlossaryRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCreateGlossaryMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
+     * exist.
+     * 
+ */ + public void listGlossaries( + com.google.cloud.translate.v3.ListGlossariesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getListGlossariesMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't
+     * exist.
+     * 
+ */ + public void getGlossary( + com.google.cloud.translate.v3.GetGlossaryRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetGlossaryMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Deletes a glossary, or cancels glossary construction
+     * if the glossary isn't created yet.
+     * Returns NOT_FOUND, if the glossary doesn't exist.
+     * 
+ */ + public void deleteGlossary( + com.google.cloud.translate.v3.DeleteGlossaryRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getDeleteGlossaryMethodHelper(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getTranslateTextMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.translate.v3.TranslateTextRequest, + com.google.cloud.translate.v3.TranslateTextResponse>( + this, METHODID_TRANSLATE_TEXT))) + .addMethod( + getDetectLanguageMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.translate.v3.DetectLanguageRequest, + com.google.cloud.translate.v3.DetectLanguageResponse>( + this, METHODID_DETECT_LANGUAGE))) + .addMethod( + getGetSupportedLanguagesMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.translate.v3.GetSupportedLanguagesRequest, + com.google.cloud.translate.v3.SupportedLanguages>( + this, METHODID_GET_SUPPORTED_LANGUAGES))) + .addMethod( + getBatchTranslateTextMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.translate.v3.BatchTranslateTextRequest, + com.google.longrunning.Operation>(this, METHODID_BATCH_TRANSLATE_TEXT))) + .addMethod( + getCreateGlossaryMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.translate.v3.CreateGlossaryRequest, + com.google.longrunning.Operation>(this, METHODID_CREATE_GLOSSARY))) + .addMethod( + getListGlossariesMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.translate.v3.ListGlossariesRequest, + com.google.cloud.translate.v3.ListGlossariesResponse>( + this, METHODID_LIST_GLOSSARIES))) + .addMethod( + getGetGlossaryMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.translate.v3.GetGlossaryRequest, + com.google.cloud.translate.v3.Glossary>(this, METHODID_GET_GLOSSARY))) + .addMethod( + getDeleteGlossaryMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.translate.v3.DeleteGlossaryRequest, + com.google.longrunning.Operation>(this, METHODID_DELETE_GLOSSARY))) + .build(); + } + } + + /** + * + * + *
+   * Provides natural language translation operations.
+   * 
+ */ + public static final class TranslationServiceStub + extends io.grpc.stub.AbstractStub { + private TranslationServiceStub(io.grpc.Channel channel) { + super(channel); + } + + private TranslationServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TranslationServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TranslationServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Translates input text and returns translated text.
+     * 
+ */ + public void translateText( + com.google.cloud.translate.v3.TranslateTextRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getTranslateTextMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Detects the language of text within a request.
+     * 
+ */ + public void detectLanguage( + com.google.cloud.translate.v3.DetectLanguageRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getDetectLanguageMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns a list of supported languages for translation.
+     * 
+ */ + public void getSupportedLanguages( + com.google.cloud.translate.v3.GetSupportedLanguagesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetSupportedLanguagesMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Translates a large volume of text in asynchronous batch mode.
+     * This function provides real-time output as the inputs are being processed.
+     * If caller cancels a request, the partial results (for an input file, it's
+     * all or nothing) may still be available on the specified output location.
+     * This call returns immediately and you can
+     * use google.longrunning.Operation.name to poll the status of the call.
+     * 
+ */ + public void batchTranslateText( + com.google.cloud.translate.v3.BatchTranslateTextRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getBatchTranslateTextMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Creates a glossary and returns the long-running operation. Returns
+     * NOT_FOUND, if the project doesn't exist.
+     * 
+ */ + public void createGlossary( + com.google.cloud.translate.v3.CreateGlossaryRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateGlossaryMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
+     * exist.
+     * 
+ */ + public void listGlossaries( + com.google.cloud.translate.v3.ListGlossariesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListGlossariesMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't
+     * exist.
+     * 
+ */ + public void getGlossary( + com.google.cloud.translate.v3.GetGlossaryRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetGlossaryMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a glossary, or cancels glossary construction
+     * if the glossary isn't created yet.
+     * Returns NOT_FOUND, if the glossary doesn't exist.
+     * 
+ */ + public void deleteGlossary( + com.google.cloud.translate.v3.DeleteGlossaryRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getDeleteGlossaryMethodHelper(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Provides natural language translation operations.
+   * 
+ */ + public static final class TranslationServiceBlockingStub + extends io.grpc.stub.AbstractStub { + private TranslationServiceBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private TranslationServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TranslationServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TranslationServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Translates input text and returns translated text.
+     * 
+ */ + public com.google.cloud.translate.v3.TranslateTextResponse translateText( + com.google.cloud.translate.v3.TranslateTextRequest request) { + return blockingUnaryCall( + getChannel(), getTranslateTextMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Detects the language of text within a request.
+     * 
+ */ + public com.google.cloud.translate.v3.DetectLanguageResponse detectLanguage( + com.google.cloud.translate.v3.DetectLanguageRequest request) { + return blockingUnaryCall( + getChannel(), getDetectLanguageMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns a list of supported languages for translation.
+     * 
+ */ + public com.google.cloud.translate.v3.SupportedLanguages getSupportedLanguages( + com.google.cloud.translate.v3.GetSupportedLanguagesRequest request) { + return blockingUnaryCall( + getChannel(), getGetSupportedLanguagesMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Translates a large volume of text in asynchronous batch mode.
+     * This function provides real-time output as the inputs are being processed.
+     * If caller cancels a request, the partial results (for an input file, it's
+     * all or nothing) may still be available on the specified output location.
+     * This call returns immediately and you can
+     * use google.longrunning.Operation.name to poll the status of the call.
+     * 
+ */ + public com.google.longrunning.Operation batchTranslateText( + com.google.cloud.translate.v3.BatchTranslateTextRequest request) { + return blockingUnaryCall( + getChannel(), getBatchTranslateTextMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates a glossary and returns the long-running operation. Returns
+     * NOT_FOUND, if the project doesn't exist.
+     * 
+ */ + public com.google.longrunning.Operation createGlossary( + com.google.cloud.translate.v3.CreateGlossaryRequest request) { + return blockingUnaryCall( + getChannel(), getCreateGlossaryMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
+     * exist.
+     * 
+ */ + public com.google.cloud.translate.v3.ListGlossariesResponse listGlossaries( + com.google.cloud.translate.v3.ListGlossariesRequest request) { + return blockingUnaryCall( + getChannel(), getListGlossariesMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't
+     * exist.
+     * 
+ */ + public com.google.cloud.translate.v3.Glossary getGlossary( + com.google.cloud.translate.v3.GetGlossaryRequest request) { + return blockingUnaryCall( + getChannel(), getGetGlossaryMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a glossary, or cancels glossary construction
+     * if the glossary isn't created yet.
+     * Returns NOT_FOUND, if the glossary doesn't exist.
+     * 
+ */ + public com.google.longrunning.Operation deleteGlossary( + com.google.cloud.translate.v3.DeleteGlossaryRequest request) { + return blockingUnaryCall( + getChannel(), getDeleteGlossaryMethodHelper(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Provides natural language translation operations.
+   * 
+ */ + public static final class TranslationServiceFutureStub + extends io.grpc.stub.AbstractStub { + private TranslationServiceFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private TranslationServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TranslationServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TranslationServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Translates input text and returns translated text.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.translate.v3.TranslateTextResponse> + translateText(com.google.cloud.translate.v3.TranslateTextRequest request) { + return futureUnaryCall( + getChannel().newCall(getTranslateTextMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Detects the language of text within a request.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.translate.v3.DetectLanguageResponse> + detectLanguage(com.google.cloud.translate.v3.DetectLanguageRequest request) { + return futureUnaryCall( + getChannel().newCall(getDetectLanguageMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns a list of supported languages for translation.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.translate.v3.SupportedLanguages> + getSupportedLanguages(com.google.cloud.translate.v3.GetSupportedLanguagesRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetSupportedLanguagesMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Translates a large volume of text in asynchronous batch mode.
+     * This function provides real-time output as the inputs are being processed.
+     * If caller cancels a request, the partial results (for an input file, it's
+     * all or nothing) may still be available on the specified output location.
+     * This call returns immediately and you can
+     * use google.longrunning.Operation.name to poll the status of the call.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + batchTranslateText(com.google.cloud.translate.v3.BatchTranslateTextRequest request) { + return futureUnaryCall( + getChannel().newCall(getBatchTranslateTextMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Creates a glossary and returns the long-running operation. Returns
+     * NOT_FOUND, if the project doesn't exist.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createGlossary(com.google.cloud.translate.v3.CreateGlossaryRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateGlossaryMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
+     * exist.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.translate.v3.ListGlossariesResponse> + listGlossaries(com.google.cloud.translate.v3.ListGlossariesRequest request) { + return futureUnaryCall( + getChannel().newCall(getListGlossariesMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't
+     * exist.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.translate.v3.Glossary> + getGlossary(com.google.cloud.translate.v3.GetGlossaryRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetGlossaryMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a glossary, or cancels glossary construction
+     * if the glossary isn't created yet.
+     * Returns NOT_FOUND, if the glossary doesn't exist.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteGlossary(com.google.cloud.translate.v3.DeleteGlossaryRequest request) { + return futureUnaryCall( + getChannel().newCall(getDeleteGlossaryMethodHelper(), getCallOptions()), request); + } + } + + private static final int METHODID_TRANSLATE_TEXT = 0; + private static final int METHODID_DETECT_LANGUAGE = 1; + private static final int METHODID_GET_SUPPORTED_LANGUAGES = 2; + private static final int METHODID_BATCH_TRANSLATE_TEXT = 3; + private static final int METHODID_CREATE_GLOSSARY = 4; + private static final int METHODID_LIST_GLOSSARIES = 5; + private static final int METHODID_GET_GLOSSARY = 6; + private static final int METHODID_DELETE_GLOSSARY = 7; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final TranslationServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(TranslationServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_TRANSLATE_TEXT: + serviceImpl.translateText( + (com.google.cloud.translate.v3.TranslateTextRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DETECT_LANGUAGE: + serviceImpl.detectLanguage( + (com.google.cloud.translate.v3.DetectLanguageRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_SUPPORTED_LANGUAGES: + serviceImpl.getSupportedLanguages( + (com.google.cloud.translate.v3.GetSupportedLanguagesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_BATCH_TRANSLATE_TEXT: + serviceImpl.batchTranslateText( + (com.google.cloud.translate.v3.BatchTranslateTextRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_GLOSSARY: + serviceImpl.createGlossary( + (com.google.cloud.translate.v3.CreateGlossaryRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_GLOSSARIES: + serviceImpl.listGlossaries( + (com.google.cloud.translate.v3.ListGlossariesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_GLOSSARY: + serviceImpl.getGlossary( + (com.google.cloud.translate.v3.GetGlossaryRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DELETE_GLOSSARY: + serviceImpl.deleteGlossary( + (com.google.cloud.translate.v3.DeleteGlossaryRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class TranslationServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + TranslationServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("TranslationService"); + } + } + + private static final class TranslationServiceFileDescriptorSupplier + extends TranslationServiceBaseDescriptorSupplier { + TranslationServiceFileDescriptorSupplier() {} + } + + private static final class TranslationServiceMethodDescriptorSupplier + extends TranslationServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + TranslationServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (TranslationServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new TranslationServiceFileDescriptorSupplier()) + .addMethod(getTranslateTextMethodHelper()) + .addMethod(getDetectLanguageMethodHelper()) + .addMethod(getGetSupportedLanguagesMethodHelper()) + .addMethod(getBatchTranslateTextMethodHelper()) + .addMethod(getCreateGlossaryMethodHelper()) + .addMethod(getListGlossariesMethodHelper()) + .addMethod(getGetGlossaryMethodHelper()) + .addMethod(getDeleteGlossaryMethodHelper()) + .build(); + } + } + } + return result; + } +} diff --git a/pom.xml b/pom.xml index 1d67dc21..4468b4a4 100644 --- a/pom.xml +++ b/pom.xml @@ -87,11 +87,21 @@ proto-google-cloud-translate-v3beta1 0.76.1-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-translate-v3 + 0.76.1-SNAPSHOT + com.google.api.grpc grpc-google-cloud-translate-v3beta1 0.76.1-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-translate-v3 + 0.76.1-SNAPSHOT + com.google.cloud google-cloud-translate @@ -222,7 +232,9 @@ proto-google-cloud-translate-v3beta1 + proto-google-cloud-translate-v3 grpc-google-cloud-translate-v3beta1 + grpc-google-cloud-translate-v3 google-cloud-translate diff --git a/proto-google-cloud-translate-v3/pom.xml b/proto-google-cloud-translate-v3/pom.xml new file mode 100644 index 00000000..138a10b0 --- /dev/null +++ b/proto-google-cloud-translate-v3/pom.xml @@ -0,0 +1,33 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-translate-v3 + 0.76.1-SNAPSHOT + proto-google-cloud-translate-v3 + PROTO library for proto-google-cloud-translate-v3 + + com.google.cloud + google-cloud-translate-parent + 1.93.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api + api-common + + + com.google.guava + guava + + + \ No newline at end of file diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateMetadata.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateMetadata.java new file mode 100644 index 00000000..1d1a6ed3 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateMetadata.java @@ -0,0 +1,1320 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * State metadata for the batch translation operation.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.BatchTranslateMetadata} + */ +public final class BatchTranslateMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.BatchTranslateMetadata) + BatchTranslateMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchTranslateMetadata.newBuilder() to construct. + private BatchTranslateMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchTranslateMetadata() { + state_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchTranslateMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + + state_ = rawValue; + break; + } + case 16: + { + translatedCharacters_ = input.readInt64(); + break; + } + case 24: + { + failedCharacters_ = input.readInt64(); + break; + } + case 32: + { + totalCharacters_ = input.readInt64(); + break; + } + case 42: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (submitTime_ != null) { + subBuilder = submitTime_.toBuilder(); + } + submitTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(submitTime_); + submitTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.BatchTranslateMetadata.class, + com.google.cloud.translate.v3.BatchTranslateMetadata.Builder.class); + } + + /** + * + * + *
+   * State of the job.
+   * 
+ * + * Protobuf enum {@code google.cloud.translation.v3.BatchTranslateMetadata.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Invalid.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * Request is being processed.
+     * 
+ * + * RUNNING = 1; + */ + RUNNING(1), + /** + * + * + *
+     * The batch is processed, and at least one item was successfully
+     * processed.
+     * 
+ * + * SUCCEEDED = 2; + */ + SUCCEEDED(2), + /** + * + * + *
+     * The batch is done and no item was successfully processed.
+     * 
+ * + * FAILED = 3; + */ + FAILED(3), + /** + * + * + *
+     * Request is in the process of being canceled after caller invoked
+     * longrunning.Operations.CancelOperation on the request id.
+     * 
+ * + * CANCELLING = 4; + */ + CANCELLING(4), + /** + * + * + *
+     * The batch is done after the user has called the
+     * longrunning.Operations.CancelOperation. Any records processed before the
+     * cancel command are output as specified in the request.
+     * 
+ * + * CANCELLED = 5; + */ + CANCELLED(5), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Invalid.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Request is being processed.
+     * 
+ * + * RUNNING = 1; + */ + public static final int RUNNING_VALUE = 1; + /** + * + * + *
+     * The batch is processed, and at least one item was successfully
+     * processed.
+     * 
+ * + * SUCCEEDED = 2; + */ + public static final int SUCCEEDED_VALUE = 2; + /** + * + * + *
+     * The batch is done and no item was successfully processed.
+     * 
+ * + * FAILED = 3; + */ + public static final int FAILED_VALUE = 3; + /** + * + * + *
+     * Request is in the process of being canceled after caller invoked
+     * longrunning.Operations.CancelOperation on the request id.
+     * 
+ * + * CANCELLING = 4; + */ + public static final int CANCELLING_VALUE = 4; + /** + * + * + *
+     * The batch is done after the user has called the
+     * longrunning.Operations.CancelOperation. Any records processed before the
+     * cancel command are output as specified in the request.
+     * 
+ * + * CANCELLED = 5; + */ + public static final int CANCELLED_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return RUNNING; + case 2: + return SUCCEEDED; + case 3: + return FAILED; + case 4: + return CANCELLING; + case 5: + return CANCELLED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.translate.v3.BatchTranslateMetadata.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.translation.v3.BatchTranslateMetadata.State) + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_; + /** + * + * + *
+   * The state of the operation.
+   * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * The state of the operation.
+   * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + public com.google.cloud.translate.v3.BatchTranslateMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.translate.v3.BatchTranslateMetadata.State result = + com.google.cloud.translate.v3.BatchTranslateMetadata.State.valueOf(state_); + return result == null + ? com.google.cloud.translate.v3.BatchTranslateMetadata.State.UNRECOGNIZED + : result; + } + + public static final int TRANSLATED_CHARACTERS_FIELD_NUMBER = 2; + private long translatedCharacters_; + /** + * + * + *
+   * Number of successfully translated characters so far (Unicode codepoints).
+   * 
+ * + * int64 translated_characters = 2; + */ + public long getTranslatedCharacters() { + return translatedCharacters_; + } + + public static final int FAILED_CHARACTERS_FIELD_NUMBER = 3; + private long failedCharacters_; + /** + * + * + *
+   * Number of characters that have failed to process so far (Unicode
+   * codepoints).
+   * 
+ * + * int64 failed_characters = 3; + */ + public long getFailedCharacters() { + return failedCharacters_; + } + + public static final int TOTAL_CHARACTERS_FIELD_NUMBER = 4; + private long totalCharacters_; + /** + * + * + *
+   * Total number of characters (Unicode codepoints).
+   * This is the total number of codepoints from input files times the number of
+   * target languages and appears here shortly after the call is submitted.
+   * 
+ * + * int64 total_characters = 4; + */ + public long getTotalCharacters() { + return totalCharacters_; + } + + public static final int SUBMIT_TIME_FIELD_NUMBER = 5; + private com.google.protobuf.Timestamp submitTime_; + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public boolean hasSubmitTime() { + return submitTime_ != null; + } + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + return submitTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : submitTime_; + } + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + return getSubmitTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ + != com.google.cloud.translate.v3.BatchTranslateMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (translatedCharacters_ != 0L) { + output.writeInt64(2, translatedCharacters_); + } + if (failedCharacters_ != 0L) { + output.writeInt64(3, failedCharacters_); + } + if (totalCharacters_ != 0L) { + output.writeInt64(4, totalCharacters_); + } + if (submitTime_ != null) { + output.writeMessage(5, getSubmitTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.cloud.translate.v3.BatchTranslateMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (translatedCharacters_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, translatedCharacters_); + } + if (failedCharacters_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, failedCharacters_); + } + if (totalCharacters_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, totalCharacters_); + } + if (submitTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getSubmitTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.BatchTranslateMetadata)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.BatchTranslateMetadata other = + (com.google.cloud.translate.v3.BatchTranslateMetadata) obj; + + if (state_ != other.state_) return false; + if (getTranslatedCharacters() != other.getTranslatedCharacters()) return false; + if (getFailedCharacters() != other.getFailedCharacters()) return false; + if (getTotalCharacters() != other.getTotalCharacters()) return false; + if (hasSubmitTime() != other.hasSubmitTime()) return false; + if (hasSubmitTime()) { + if (!getSubmitTime().equals(other.getSubmitTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + TRANSLATED_CHARACTERS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getTranslatedCharacters()); + hash = (37 * hash) + FAILED_CHARACTERS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getFailedCharacters()); + hash = (37 * hash) + TOTAL_CHARACTERS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getTotalCharacters()); + if (hasSubmitTime()) { + hash = (37 * hash) + SUBMIT_TIME_FIELD_NUMBER; + hash = (53 * hash) + getSubmitTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.BatchTranslateMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * State metadata for the batch translation operation.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.BatchTranslateMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.BatchTranslateMetadata) + com.google.cloud.translate.v3.BatchTranslateMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.BatchTranslateMetadata.class, + com.google.cloud.translate.v3.BatchTranslateMetadata.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.BatchTranslateMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + state_ = 0; + + translatedCharacters_ = 0L; + + failedCharacters_ = 0L; + + totalCharacters_ = 0L; + + if (submitTimeBuilder_ == null) { + submitTime_ = null; + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateMetadata getDefaultInstanceForType() { + return com.google.cloud.translate.v3.BatchTranslateMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateMetadata build() { + com.google.cloud.translate.v3.BatchTranslateMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateMetadata buildPartial() { + com.google.cloud.translate.v3.BatchTranslateMetadata result = + new com.google.cloud.translate.v3.BatchTranslateMetadata(this); + result.state_ = state_; + result.translatedCharacters_ = translatedCharacters_; + result.failedCharacters_ = failedCharacters_; + result.totalCharacters_ = totalCharacters_; + if (submitTimeBuilder_ == null) { + result.submitTime_ = submitTime_; + } else { + result.submitTime_ = submitTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.BatchTranslateMetadata) { + return mergeFrom((com.google.cloud.translate.v3.BatchTranslateMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.BatchTranslateMetadata other) { + if (other == com.google.cloud.translate.v3.BatchTranslateMetadata.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.getTranslatedCharacters() != 0L) { + setTranslatedCharacters(other.getTranslatedCharacters()); + } + if (other.getFailedCharacters() != 0L) { + setFailedCharacters(other.getFailedCharacters()); + } + if (other.getTotalCharacters() != 0L) { + setTotalCharacters(other.getTotalCharacters()); + } + if (other.hasSubmitTime()) { + mergeSubmitTime(other.getSubmitTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.BatchTranslateMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.BatchTranslateMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + public Builder setStateValue(int value) { + state_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + public com.google.cloud.translate.v3.BatchTranslateMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.translate.v3.BatchTranslateMetadata.State result = + com.google.cloud.translate.v3.BatchTranslateMetadata.State.valueOf(state_); + return result == null + ? com.google.cloud.translate.v3.BatchTranslateMetadata.State.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + public Builder setState(com.google.cloud.translate.v3.BatchTranslateMetadata.State value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The state of the operation.
+     * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private long translatedCharacters_; + /** + * + * + *
+     * Number of successfully translated characters so far (Unicode codepoints).
+     * 
+ * + * int64 translated_characters = 2; + */ + public long getTranslatedCharacters() { + return translatedCharacters_; + } + /** + * + * + *
+     * Number of successfully translated characters so far (Unicode codepoints).
+     * 
+ * + * int64 translated_characters = 2; + */ + public Builder setTranslatedCharacters(long value) { + + translatedCharacters_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of successfully translated characters so far (Unicode codepoints).
+     * 
+ * + * int64 translated_characters = 2; + */ + public Builder clearTranslatedCharacters() { + + translatedCharacters_ = 0L; + onChanged(); + return this; + } + + private long failedCharacters_; + /** + * + * + *
+     * Number of characters that have failed to process so far (Unicode
+     * codepoints).
+     * 
+ * + * int64 failed_characters = 3; + */ + public long getFailedCharacters() { + return failedCharacters_; + } + /** + * + * + *
+     * Number of characters that have failed to process so far (Unicode
+     * codepoints).
+     * 
+ * + * int64 failed_characters = 3; + */ + public Builder setFailedCharacters(long value) { + + failedCharacters_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of characters that have failed to process so far (Unicode
+     * codepoints).
+     * 
+ * + * int64 failed_characters = 3; + */ + public Builder clearFailedCharacters() { + + failedCharacters_ = 0L; + onChanged(); + return this; + } + + private long totalCharacters_; + /** + * + * + *
+     * Total number of characters (Unicode codepoints).
+     * This is the total number of codepoints from input files times the number of
+     * target languages and appears here shortly after the call is submitted.
+     * 
+ * + * int64 total_characters = 4; + */ + public long getTotalCharacters() { + return totalCharacters_; + } + /** + * + * + *
+     * Total number of characters (Unicode codepoints).
+     * This is the total number of codepoints from input files times the number of
+     * target languages and appears here shortly after the call is submitted.
+     * 
+ * + * int64 total_characters = 4; + */ + public Builder setTotalCharacters(long value) { + + totalCharacters_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Total number of characters (Unicode codepoints).
+     * This is the total number of codepoints from input files times the number of
+     * target languages and appears here shortly after the call is submitted.
+     * 
+ * + * int64 total_characters = 4; + */ + public Builder clearTotalCharacters() { + + totalCharacters_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp submitTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + submitTimeBuilder_; + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public boolean hasSubmitTime() { + return submitTimeBuilder_ != null || submitTime_ != null; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + if (submitTimeBuilder_ == null) { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } else { + return submitTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + submitTime_ = value; + onChanged(); + } else { + submitTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (submitTimeBuilder_ == null) { + submitTime_ = builderForValue.build(); + onChanged(); + } else { + submitTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public Builder mergeSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (submitTime_ != null) { + submitTime_ = + com.google.protobuf.Timestamp.newBuilder(submitTime_).mergeFrom(value).buildPartial(); + } else { + submitTime_ = value; + } + onChanged(); + } else { + submitTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public Builder clearSubmitTime() { + if (submitTimeBuilder_ == null) { + submitTime_ = null; + onChanged(); + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public com.google.protobuf.Timestamp.Builder getSubmitTimeBuilder() { + + onChanged(); + return getSubmitTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + if (submitTimeBuilder_ != null) { + return submitTimeBuilder_.getMessageOrBuilder(); + } else { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getSubmitTimeFieldBuilder() { + if (submitTimeBuilder_ == null) { + submitTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getSubmitTime(), getParentForChildren(), isClean()); + submitTime_ = null; + } + return submitTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.BatchTranslateMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateMetadata) + private static final com.google.cloud.translate.v3.BatchTranslateMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.BatchTranslateMetadata(); + } + + public static com.google.cloud.translate.v3.BatchTranslateMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchTranslateMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchTranslateMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateMetadataOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateMetadataOrBuilder.java new file mode 100644 index 00000000..adbaf4cc --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateMetadataOrBuilder.java @@ -0,0 +1,113 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface BatchTranslateMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.BatchTranslateMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The state of the operation.
+   * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + int getStateValue(); + /** + * + * + *
+   * The state of the operation.
+   * 
+ * + * .google.cloud.translation.v3.BatchTranslateMetadata.State state = 1; + */ + com.google.cloud.translate.v3.BatchTranslateMetadata.State getState(); + + /** + * + * + *
+   * Number of successfully translated characters so far (Unicode codepoints).
+   * 
+ * + * int64 translated_characters = 2; + */ + long getTranslatedCharacters(); + + /** + * + * + *
+   * Number of characters that have failed to process so far (Unicode
+   * codepoints).
+   * 
+ * + * int64 failed_characters = 3; + */ + long getFailedCharacters(); + + /** + * + * + *
+   * Total number of characters (Unicode codepoints).
+   * This is the total number of codepoints from input files times the number of
+   * target languages and appears here shortly after the call is submitted.
+   * 
+ * + * int64 total_characters = 4; + */ + long getTotalCharacters(); + + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + boolean hasSubmitTime(); + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + com.google.protobuf.Timestamp getSubmitTime(); + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 5; + */ + com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateResponse.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateResponse.java new file mode 100644 index 00000000..96eba9f1 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateResponse.java @@ -0,0 +1,1236 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Stored in the
+ * [google.longrunning.Operation.response][google.longrunning.Operation.response]
+ * field returned by BatchTranslateText if at least one sentence is translated
+ * successfully.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.BatchTranslateResponse} + */ +public final class BatchTranslateResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.BatchTranslateResponse) + BatchTranslateResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchTranslateResponse.newBuilder() to construct. + private BatchTranslateResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchTranslateResponse() {} + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchTranslateResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + totalCharacters_ = input.readInt64(); + break; + } + case 16: + { + translatedCharacters_ = input.readInt64(); + break; + } + case 24: + { + failedCharacters_ = input.readInt64(); + break; + } + case 34: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (submitTime_ != null) { + subBuilder = submitTime_.toBuilder(); + } + submitTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(submitTime_); + submitTime_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (endTime_ != null) { + subBuilder = endTime_.toBuilder(); + } + endTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(endTime_); + endTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.BatchTranslateResponse.class, + com.google.cloud.translate.v3.BatchTranslateResponse.Builder.class); + } + + public static final int TOTAL_CHARACTERS_FIELD_NUMBER = 1; + private long totalCharacters_; + /** + * + * + *
+   * Total number of characters (Unicode codepoints).
+   * 
+ * + * int64 total_characters = 1; + */ + public long getTotalCharacters() { + return totalCharacters_; + } + + public static final int TRANSLATED_CHARACTERS_FIELD_NUMBER = 2; + private long translatedCharacters_; + /** + * + * + *
+   * Number of successfully translated characters (Unicode codepoints).
+   * 
+ * + * int64 translated_characters = 2; + */ + public long getTranslatedCharacters() { + return translatedCharacters_; + } + + public static final int FAILED_CHARACTERS_FIELD_NUMBER = 3; + private long failedCharacters_; + /** + * + * + *
+   * Number of characters that have failed to process (Unicode codepoints).
+   * 
+ * + * int64 failed_characters = 3; + */ + public long getFailedCharacters() { + return failedCharacters_; + } + + public static final int SUBMIT_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp submitTime_; + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public boolean hasSubmitTime() { + return submitTime_ != null; + } + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + return submitTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : submitTime_; + } + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + return getSubmitTime(); + } + + public static final int END_TIME_FIELD_NUMBER = 5; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+   * The time when the operation is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public boolean hasEndTime() { + return endTime_ != null; + } + /** + * + * + *
+   * The time when the operation is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+   * The time when the operation is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return getEndTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (totalCharacters_ != 0L) { + output.writeInt64(1, totalCharacters_); + } + if (translatedCharacters_ != 0L) { + output.writeInt64(2, translatedCharacters_); + } + if (failedCharacters_ != 0L) { + output.writeInt64(3, failedCharacters_); + } + if (submitTime_ != null) { + output.writeMessage(4, getSubmitTime()); + } + if (endTime_ != null) { + output.writeMessage(5, getEndTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (totalCharacters_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, totalCharacters_); + } + if (translatedCharacters_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, translatedCharacters_); + } + if (failedCharacters_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, failedCharacters_); + } + if (submitTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getSubmitTime()); + } + if (endTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getEndTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.BatchTranslateResponse)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.BatchTranslateResponse other = + (com.google.cloud.translate.v3.BatchTranslateResponse) obj; + + if (getTotalCharacters() != other.getTotalCharacters()) return false; + if (getTranslatedCharacters() != other.getTranslatedCharacters()) return false; + if (getFailedCharacters() != other.getFailedCharacters()) return false; + if (hasSubmitTime() != other.hasSubmitTime()) return false; + if (hasSubmitTime()) { + if (!getSubmitTime().equals(other.getSubmitTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TOTAL_CHARACTERS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getTotalCharacters()); + hash = (37 * hash) + TRANSLATED_CHARACTERS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getTranslatedCharacters()); + hash = (37 * hash) + FAILED_CHARACTERS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getFailedCharacters()); + if (hasSubmitTime()) { + hash = (37 * hash) + SUBMIT_TIME_FIELD_NUMBER; + hash = (53 * hash) + getSubmitTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.BatchTranslateResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Stored in the
+   * [google.longrunning.Operation.response][google.longrunning.Operation.response]
+   * field returned by BatchTranslateText if at least one sentence is translated
+   * successfully.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.BatchTranslateResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.BatchTranslateResponse) + com.google.cloud.translate.v3.BatchTranslateResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.BatchTranslateResponse.class, + com.google.cloud.translate.v3.BatchTranslateResponse.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.BatchTranslateResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + totalCharacters_ = 0L; + + translatedCharacters_ = 0L; + + failedCharacters_ = 0L; + + if (submitTimeBuilder_ == null) { + submitTime_ = null; + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + if (endTimeBuilder_ == null) { + endTime_ = null; + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateResponse getDefaultInstanceForType() { + return com.google.cloud.translate.v3.BatchTranslateResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateResponse build() { + com.google.cloud.translate.v3.BatchTranslateResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateResponse buildPartial() { + com.google.cloud.translate.v3.BatchTranslateResponse result = + new com.google.cloud.translate.v3.BatchTranslateResponse(this); + result.totalCharacters_ = totalCharacters_; + result.translatedCharacters_ = translatedCharacters_; + result.failedCharacters_ = failedCharacters_; + if (submitTimeBuilder_ == null) { + result.submitTime_ = submitTime_; + } else { + result.submitTime_ = submitTimeBuilder_.build(); + } + if (endTimeBuilder_ == null) { + result.endTime_ = endTime_; + } else { + result.endTime_ = endTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.BatchTranslateResponse) { + return mergeFrom((com.google.cloud.translate.v3.BatchTranslateResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.BatchTranslateResponse other) { + if (other == com.google.cloud.translate.v3.BatchTranslateResponse.getDefaultInstance()) + return this; + if (other.getTotalCharacters() != 0L) { + setTotalCharacters(other.getTotalCharacters()); + } + if (other.getTranslatedCharacters() != 0L) { + setTranslatedCharacters(other.getTranslatedCharacters()); + } + if (other.getFailedCharacters() != 0L) { + setFailedCharacters(other.getFailedCharacters()); + } + if (other.hasSubmitTime()) { + mergeSubmitTime(other.getSubmitTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.BatchTranslateResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.BatchTranslateResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long totalCharacters_; + /** + * + * + *
+     * Total number of characters (Unicode codepoints).
+     * 
+ * + * int64 total_characters = 1; + */ + public long getTotalCharacters() { + return totalCharacters_; + } + /** + * + * + *
+     * Total number of characters (Unicode codepoints).
+     * 
+ * + * int64 total_characters = 1; + */ + public Builder setTotalCharacters(long value) { + + totalCharacters_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Total number of characters (Unicode codepoints).
+     * 
+ * + * int64 total_characters = 1; + */ + public Builder clearTotalCharacters() { + + totalCharacters_ = 0L; + onChanged(); + return this; + } + + private long translatedCharacters_; + /** + * + * + *
+     * Number of successfully translated characters (Unicode codepoints).
+     * 
+ * + * int64 translated_characters = 2; + */ + public long getTranslatedCharacters() { + return translatedCharacters_; + } + /** + * + * + *
+     * Number of successfully translated characters (Unicode codepoints).
+     * 
+ * + * int64 translated_characters = 2; + */ + public Builder setTranslatedCharacters(long value) { + + translatedCharacters_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of successfully translated characters (Unicode codepoints).
+     * 
+ * + * int64 translated_characters = 2; + */ + public Builder clearTranslatedCharacters() { + + translatedCharacters_ = 0L; + onChanged(); + return this; + } + + private long failedCharacters_; + /** + * + * + *
+     * Number of characters that have failed to process (Unicode codepoints).
+     * 
+ * + * int64 failed_characters = 3; + */ + public long getFailedCharacters() { + return failedCharacters_; + } + /** + * + * + *
+     * Number of characters that have failed to process (Unicode codepoints).
+     * 
+ * + * int64 failed_characters = 3; + */ + public Builder setFailedCharacters(long value) { + + failedCharacters_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of characters that have failed to process (Unicode codepoints).
+     * 
+ * + * int64 failed_characters = 3; + */ + public Builder clearFailedCharacters() { + + failedCharacters_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp submitTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + submitTimeBuilder_; + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public boolean hasSubmitTime() { + return submitTimeBuilder_ != null || submitTime_ != null; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + if (submitTimeBuilder_ == null) { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } else { + return submitTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + submitTime_ = value; + onChanged(); + } else { + submitTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (submitTimeBuilder_ == null) { + submitTime_ = builderForValue.build(); + onChanged(); + } else { + submitTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public Builder mergeSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (submitTime_ != null) { + submitTime_ = + com.google.protobuf.Timestamp.newBuilder(submitTime_).mergeFrom(value).buildPartial(); + } else { + submitTime_ = value; + } + onChanged(); + } else { + submitTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public Builder clearSubmitTime() { + if (submitTimeBuilder_ == null) { + submitTime_ = null; + onChanged(); + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public com.google.protobuf.Timestamp.Builder getSubmitTimeBuilder() { + + onChanged(); + return getSubmitTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + if (submitTimeBuilder_ != null) { + return submitTimeBuilder_.getMessageOrBuilder(); + } else { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } + } + /** + * + * + *
+     * Time when the operation was submitted.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getSubmitTimeFieldBuilder() { + if (submitTimeBuilder_ == null) { + submitTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getSubmitTime(), getParentForChildren(), isClean()); + submitTime_ = null; + } + return submitTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public boolean hasEndTime() { + return endTimeBuilder_ != null || endTime_ != null; + } + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + onChanged(); + } else { + endTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + onChanged(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (endTime_ != null) { + endTime_ = + com.google.protobuf.Timestamp.newBuilder(endTime_).mergeFrom(value).buildPartial(); + } else { + endTime_ = value; + } + onChanged(); + } else { + endTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public Builder clearEndTime() { + if (endTimeBuilder_ == null) { + endTime_ = null; + onChanged(); + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+     * The time when the operation is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.BatchTranslateResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateResponse) + private static final com.google.cloud.translate.v3.BatchTranslateResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.BatchTranslateResponse(); + } + + public static com.google.cloud.translate.v3.BatchTranslateResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchTranslateResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchTranslateResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateResponseOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateResponseOrBuilder.java new file mode 100644 index 00000000..da983f41 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateResponseOrBuilder.java @@ -0,0 +1,126 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface BatchTranslateResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.BatchTranslateResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Total number of characters (Unicode codepoints).
+   * 
+ * + * int64 total_characters = 1; + */ + long getTotalCharacters(); + + /** + * + * + *
+   * Number of successfully translated characters (Unicode codepoints).
+   * 
+ * + * int64 translated_characters = 2; + */ + long getTranslatedCharacters(); + + /** + * + * + *
+   * Number of characters that have failed to process (Unicode codepoints).
+   * 
+ * + * int64 failed_characters = 3; + */ + long getFailedCharacters(); + + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + boolean hasSubmitTime(); + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + com.google.protobuf.Timestamp getSubmitTime(); + /** + * + * + *
+   * Time when the operation was submitted.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 4; + */ + com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder(); + + /** + * + * + *
+   * The time when the operation is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + boolean hasEndTime(); + /** + * + * + *
+   * The time when the operation is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+   * The time when the operation is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 5; + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateTextRequest.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateTextRequest.java new file mode 100644 index 00000000..699e69c6 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateTextRequest.java @@ -0,0 +1,3121 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The batch translation request.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.BatchTranslateTextRequest} + */ +public final class BatchTranslateTextRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.BatchTranslateTextRequest) + BatchTranslateTextRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchTranslateTextRequest.newBuilder() to construct. + private BatchTranslateTextRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchTranslateTextRequest() { + parent_ = ""; + sourceLanguageCode_ = ""; + targetLanguageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + inputConfigs_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchTranslateTextRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + sourceLanguageCode_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + targetLanguageCodes_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + targetLanguageCodes_.add(s); + break; + } + case 34: + { + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + models_ = + com.google.protobuf.MapField.newMapField(ModelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000008; + } + com.google.protobuf.MapEntry models__ = + input.readMessage( + ModelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + models_.getMutableMap().put(models__.getKey(), models__.getValue()); + break; + } + case 42: + { + if (!((mutable_bitField0_ & 0x00000010) != 0)) { + inputConfigs_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000010; + } + inputConfigs_.add( + input.readMessage( + com.google.cloud.translate.v3.InputConfig.parser(), extensionRegistry)); + break; + } + case 50: + { + com.google.cloud.translate.v3.OutputConfig.Builder subBuilder = null; + if (outputConfig_ != null) { + subBuilder = outputConfig_.toBuilder(); + } + outputConfig_ = + input.readMessage( + com.google.cloud.translate.v3.OutputConfig.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(outputConfig_); + outputConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + if (!((mutable_bitField0_ & 0x00000040) != 0)) { + glossaries_ = + com.google.protobuf.MapField.newMapField( + GlossariesDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000040; + } + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + glossaries__ = + input.readMessage( + GlossariesDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + glossaries_.getMutableMap().put(glossaries__.getKey(), glossaries__.getValue()); + break; + } + case 74: + { + if (!((mutable_bitField0_ & 0x00000080) != 0)) { + labels_ = + com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000080; + } + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000004) != 0)) { + targetLanguageCodes_ = targetLanguageCodes_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000010) != 0)) { + inputConfigs_ = java.util.Collections.unmodifiableList(inputConfigs_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 4: + return internalGetModels(); + case 7: + return internalGetGlossaries(); + case 9: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.BatchTranslateTextRequest.class, + com.google.cloud.translate.v3.BatchTranslateTextRequest.Builder.class); + } + + private int bitField0_; + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Location to make a call. Must refer to a caller's project.
+   * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+   * The `global` location is not supported for batch translation.
+   * Only AutoML Translation models or glossaries within the same region (have
+   * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+   * error is returned.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Location to make a call. Must refer to a caller's project.
+   * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+   * The `global` location is not supported for batch translation.
+   * Only AutoML Translation models or glossaries within the same region (have
+   * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+   * error is returned.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SOURCE_LANGUAGE_CODE_FIELD_NUMBER = 2; + private volatile java.lang.Object sourceLanguageCode_; + /** + * + * + *
+   * Required. Source language code.
+   * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getSourceLanguageCode() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceLanguageCode_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Source language code.
+   * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getSourceLanguageCodeBytes() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sourceLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TARGET_LANGUAGE_CODES_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList targetLanguageCodes_; + /** + * + * + *
+   * Required. Specify up to 10 language codes here.
+   * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.ProtocolStringList getTargetLanguageCodesList() { + return targetLanguageCodes_; + } + /** + * + * + *
+   * Required. Specify up to 10 language codes here.
+   * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getTargetLanguageCodesCount() { + return targetLanguageCodes_.size(); + } + /** + * + * + *
+   * Required. Specify up to 10 language codes here.
+   * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.lang.String getTargetLanguageCodes(int index) { + return targetLanguageCodes_.get(index); + } + /** + * + * + *
+   * Required. Specify up to 10 language codes here.
+   * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.ByteString getTargetLanguageCodesBytes(int index) { + return targetLanguageCodes_.getByteString(index); + } + + public static final int MODELS_FIELD_NUMBER = 4; + + private static final class ModelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_ModelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField models_; + + private com.google.protobuf.MapField internalGetModels() { + if (models_ == null) { + return com.google.protobuf.MapField.emptyMapField(ModelsDefaultEntryHolder.defaultEntry); + } + return models_; + } + + public int getModelsCount() { + return internalGetModels().getMap().size(); + } + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean containsModels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetModels().getMap().containsKey(key); + } + /** Use {@link #getModelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getModels() { + return getModelsMap(); + } + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.util.Map getModelsMap() { + return internalGetModels().getMap(); + } + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetModels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetModels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int INPUT_CONFIGS_FIELD_NUMBER = 5; + private java.util.List inputConfigs_; + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List getInputConfigsList() { + return inputConfigs_; + } + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getInputConfigsOrBuilderList() { + return inputConfigs_; + } + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getInputConfigsCount() { + return inputConfigs_.size(); + } + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.InputConfig getInputConfigs(int index) { + return inputConfigs_.get(index); + } + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.InputConfigOrBuilder getInputConfigsOrBuilder(int index) { + return inputConfigs_.get(index); + } + + public static final int OUTPUT_CONFIG_FIELD_NUMBER = 6; + private com.google.cloud.translate.v3.OutputConfig outputConfig_; + /** + * + * + *
+   * Required. Output configuration.
+   * If 2 input configs match to the same file (that is, same input path),
+   * we don't generate output for duplicate inputs.
+   * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasOutputConfig() { + return outputConfig_ != null; + } + /** + * + * + *
+   * Required. Output configuration.
+   * If 2 input configs match to the same file (that is, same input path),
+   * we don't generate output for duplicate inputs.
+   * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.OutputConfig getOutputConfig() { + return outputConfig_ == null + ? com.google.cloud.translate.v3.OutputConfig.getDefaultInstance() + : outputConfig_; + } + /** + * + * + *
+   * Required. Output configuration.
+   * If 2 input configs match to the same file (that is, same input path),
+   * we don't generate output for duplicate inputs.
+   * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.OutputConfigOrBuilder getOutputConfigOrBuilder() { + return getOutputConfig(); + } + + public static final int GLOSSARIES_FIELD_NUMBER = 7; + + private static final class GlossariesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + defaultEntry = + com.google.protobuf.MapEntry + . + newDefaultInstance( + com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_GlossariesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig + .getDefaultInstance()); + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + glossaries_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + internalGetGlossaries() { + if (glossaries_ == null) { + return com.google.protobuf.MapField.emptyMapField(GlossariesDefaultEntryHolder.defaultEntry); + } + return glossaries_; + } + + public int getGlossariesCount() { + return internalGetGlossaries().getMap().size(); + } + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean containsGlossaries(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetGlossaries().getMap().containsKey(key); + } + /** Use {@link #getGlossariesMap()} instead. */ + @java.lang.Deprecated + public java.util.Map + getGlossaries() { + return getGlossariesMap(); + } + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.Map + getGlossariesMap() { + return internalGetGlossaries().getMap(); + } + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossariesOrDefault( + java.lang.String key, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetGlossaries().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossariesOrThrow( + java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetGlossaries().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int LABELS_FIELD_NUMBER = 9; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!getSourceLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, sourceLanguageCode_); + } + for (int i = 0; i < targetLanguageCodes_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, targetLanguageCodes_.getRaw(i)); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetModels(), ModelsDefaultEntryHolder.defaultEntry, 4); + for (int i = 0; i < inputConfigs_.size(); i++) { + output.writeMessage(5, inputConfigs_.get(i)); + } + if (outputConfig_ != null) { + output.writeMessage(6, getOutputConfig()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetGlossaries(), GlossariesDefaultEntryHolder.defaultEntry, 7); + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 9); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!getSourceLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, sourceLanguageCode_); + } + { + int dataSize = 0; + for (int i = 0; i < targetLanguageCodes_.size(); i++) { + dataSize += computeStringSizeNoTag(targetLanguageCodes_.getRaw(i)); + } + size += dataSize; + size += 1 * getTargetLanguageCodesList().size(); + } + for (java.util.Map.Entry entry : + internalGetModels().getMap().entrySet()) { + com.google.protobuf.MapEntry models__ = + ModelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, models__); + } + for (int i = 0; i < inputConfigs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, inputConfigs_.get(i)); + } + if (outputConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getOutputConfig()); + } + for (java.util.Map.Entry< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + entry : internalGetGlossaries().getMap().entrySet()) { + com.google.protobuf.MapEntry< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + glossaries__ = + GlossariesDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, glossaries__); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, labels__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.BatchTranslateTextRequest)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.BatchTranslateTextRequest other = + (com.google.cloud.translate.v3.BatchTranslateTextRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getSourceLanguageCode().equals(other.getSourceLanguageCode())) return false; + if (!getTargetLanguageCodesList().equals(other.getTargetLanguageCodesList())) return false; + if (!internalGetModels().equals(other.internalGetModels())) return false; + if (!getInputConfigsList().equals(other.getInputConfigsList())) return false; + if (hasOutputConfig() != other.hasOutputConfig()) return false; + if (hasOutputConfig()) { + if (!getOutputConfig().equals(other.getOutputConfig())) return false; + } + if (!internalGetGlossaries().equals(other.internalGetGlossaries())) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + SOURCE_LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getSourceLanguageCode().hashCode(); + if (getTargetLanguageCodesCount() > 0) { + hash = (37 * hash) + TARGET_LANGUAGE_CODES_FIELD_NUMBER; + hash = (53 * hash) + getTargetLanguageCodesList().hashCode(); + } + if (!internalGetModels().getMap().isEmpty()) { + hash = (37 * hash) + MODELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetModels().hashCode(); + } + if (getInputConfigsCount() > 0) { + hash = (37 * hash) + INPUT_CONFIGS_FIELD_NUMBER; + hash = (53 * hash) + getInputConfigsList().hashCode(); + } + if (hasOutputConfig()) { + hash = (37 * hash) + OUTPUT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getOutputConfig().hashCode(); + } + if (!internalGetGlossaries().getMap().isEmpty()) { + hash = (37 * hash) + GLOSSARIES_FIELD_NUMBER; + hash = (53 * hash) + internalGetGlossaries().hashCode(); + } + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.translate.v3.BatchTranslateTextRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The batch translation request.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.BatchTranslateTextRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.BatchTranslateTextRequest) + com.google.cloud.translate.v3.BatchTranslateTextRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 4: + return internalGetModels(); + case 7: + return internalGetGlossaries(); + case 9: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 4: + return internalGetMutableModels(); + case 7: + return internalGetMutableGlossaries(); + case 9: + return internalGetMutableLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.BatchTranslateTextRequest.class, + com.google.cloud.translate.v3.BatchTranslateTextRequest.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.BatchTranslateTextRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInputConfigsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + sourceLanguageCode_ = ""; + + targetLanguageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableModels().clear(); + if (inputConfigsBuilder_ == null) { + inputConfigs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + } else { + inputConfigsBuilder_.clear(); + } + if (outputConfigBuilder_ == null) { + outputConfig_ = null; + } else { + outputConfig_ = null; + outputConfigBuilder_ = null; + } + internalGetMutableGlossaries().clear(); + internalGetMutableLabels().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateTextRequest getDefaultInstanceForType() { + return com.google.cloud.translate.v3.BatchTranslateTextRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateTextRequest build() { + com.google.cloud.translate.v3.BatchTranslateTextRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateTextRequest buildPartial() { + com.google.cloud.translate.v3.BatchTranslateTextRequest result = + new com.google.cloud.translate.v3.BatchTranslateTextRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.parent_ = parent_; + result.sourceLanguageCode_ = sourceLanguageCode_; + if (((bitField0_ & 0x00000004) != 0)) { + targetLanguageCodes_ = targetLanguageCodes_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.targetLanguageCodes_ = targetLanguageCodes_; + result.models_ = internalGetModels(); + result.models_.makeImmutable(); + if (inputConfigsBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0)) { + inputConfigs_ = java.util.Collections.unmodifiableList(inputConfigs_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.inputConfigs_ = inputConfigs_; + } else { + result.inputConfigs_ = inputConfigsBuilder_.build(); + } + if (outputConfigBuilder_ == null) { + result.outputConfig_ = outputConfig_; + } else { + result.outputConfig_ = outputConfigBuilder_.build(); + } + result.glossaries_ = internalGetGlossaries(); + result.glossaries_.makeImmutable(); + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.BatchTranslateTextRequest) { + return mergeFrom((com.google.cloud.translate.v3.BatchTranslateTextRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.BatchTranslateTextRequest other) { + if (other == com.google.cloud.translate.v3.BatchTranslateTextRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getSourceLanguageCode().isEmpty()) { + sourceLanguageCode_ = other.sourceLanguageCode_; + onChanged(); + } + if (!other.targetLanguageCodes_.isEmpty()) { + if (targetLanguageCodes_.isEmpty()) { + targetLanguageCodes_ = other.targetLanguageCodes_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureTargetLanguageCodesIsMutable(); + targetLanguageCodes_.addAll(other.targetLanguageCodes_); + } + onChanged(); + } + internalGetMutableModels().mergeFrom(other.internalGetModels()); + if (inputConfigsBuilder_ == null) { + if (!other.inputConfigs_.isEmpty()) { + if (inputConfigs_.isEmpty()) { + inputConfigs_ = other.inputConfigs_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureInputConfigsIsMutable(); + inputConfigs_.addAll(other.inputConfigs_); + } + onChanged(); + } + } else { + if (!other.inputConfigs_.isEmpty()) { + if (inputConfigsBuilder_.isEmpty()) { + inputConfigsBuilder_.dispose(); + inputConfigsBuilder_ = null; + inputConfigs_ = other.inputConfigs_; + bitField0_ = (bitField0_ & ~0x00000010); + inputConfigsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getInputConfigsFieldBuilder() + : null; + } else { + inputConfigsBuilder_.addAllMessages(other.inputConfigs_); + } + } + } + if (other.hasOutputConfig()) { + mergeOutputConfig(other.getOutputConfig()); + } + internalGetMutableGlossaries().mergeFrom(other.internalGetGlossaries()); + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.BatchTranslateTextRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.BatchTranslateTextRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Location to make a call. Must refer to a caller's project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+     * The `global` location is not supported for batch translation.
+     * Only AutoML Translation models or glossaries within the same region (have
+     * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+     * error is returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Location to make a call. Must refer to a caller's project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+     * The `global` location is not supported for batch translation.
+     * Only AutoML Translation models or glossaries within the same region (have
+     * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+     * error is returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Location to make a call. Must refer to a caller's project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+     * The `global` location is not supported for batch translation.
+     * Only AutoML Translation models or glossaries within the same region (have
+     * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+     * error is returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Location to make a call. Must refer to a caller's project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+     * The `global` location is not supported for batch translation.
+     * Only AutoML Translation models or glossaries within the same region (have
+     * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+     * error is returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Location to make a call. Must refer to a caller's project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+     * The `global` location is not supported for batch translation.
+     * Only AutoML Translation models or glossaries within the same region (have
+     * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+     * error is returned.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object sourceLanguageCode_ = ""; + /** + * + * + *
+     * Required. Source language code.
+     * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getSourceLanguageCode() { + java.lang.Object ref = sourceLanguageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceLanguageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Source language code.
+     * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getSourceLanguageCodeBytes() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sourceLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Source language code.
+     * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setSourceLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sourceLanguageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Source language code.
+     * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearSourceLanguageCode() { + + sourceLanguageCode_ = getDefaultInstance().getSourceLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Source language code.
+     * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setSourceLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sourceLanguageCode_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList targetLanguageCodes_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureTargetLanguageCodesIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + targetLanguageCodes_ = new com.google.protobuf.LazyStringArrayList(targetLanguageCodes_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.ProtocolStringList getTargetLanguageCodesList() { + return targetLanguageCodes_.getUnmodifiableView(); + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getTargetLanguageCodesCount() { + return targetLanguageCodes_.size(); + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.lang.String getTargetLanguageCodes(int index) { + return targetLanguageCodes_.get(index); + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.ByteString getTargetLanguageCodesBytes(int index) { + return targetLanguageCodes_.getByteString(index); + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setTargetLanguageCodes(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTargetLanguageCodesIsMutable(); + targetLanguageCodes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addTargetLanguageCodes(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTargetLanguageCodesIsMutable(); + targetLanguageCodes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addAllTargetLanguageCodes(java.lang.Iterable values) { + ensureTargetLanguageCodesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, targetLanguageCodes_); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearTargetLanguageCodes() { + targetLanguageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Specify up to 10 language codes here.
+     * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addTargetLanguageCodesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureTargetLanguageCodesIsMutable(); + targetLanguageCodes_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.MapField models_; + + private com.google.protobuf.MapField internalGetModels() { + if (models_ == null) { + return com.google.protobuf.MapField.emptyMapField(ModelsDefaultEntryHolder.defaultEntry); + } + return models_; + } + + private com.google.protobuf.MapField + internalGetMutableModels() { + onChanged(); + ; + if (models_ == null) { + models_ = com.google.protobuf.MapField.newMapField(ModelsDefaultEntryHolder.defaultEntry); + } + if (!models_.isMutable()) { + models_ = models_.copy(); + } + return models_; + } + + public int getModelsCount() { + return internalGetModels().getMap().size(); + } + /** + * + * + *
+     * Optional. The models to use for translation. Map's key is target language
+     * code. Map's value is model name. Value can be a built-in general model,
+     * or an AutoML Translation model.
+     * The value format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * If the map is empty or a specific model is
+     * not requested for a language pair, then default google model (nmt) is used.
+     * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean containsModels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetModels().getMap().containsKey(key); + } + /** Use {@link #getModelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getModels() { + return getModelsMap(); + } + /** + * + * + *
+     * Optional. The models to use for translation. Map's key is target language
+     * code. Map's value is model name. Value can be a built-in general model,
+     * or an AutoML Translation model.
+     * The value format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * If the map is empty or a specific model is
+     * not requested for a language pair, then default google model (nmt) is used.
+     * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.util.Map getModelsMap() { + return internalGetModels().getMap(); + } + /** + * + * + *
+     * Optional. The models to use for translation. Map's key is target language
+     * code. Map's value is model name. Value can be a built-in general model,
+     * or an AutoML Translation model.
+     * The value format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * If the map is empty or a specific model is
+     * not requested for a language pair, then default google model (nmt) is used.
+     * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetModels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional. The models to use for translation. Map's key is target language
+     * code. Map's value is model name. Value can be a built-in general model,
+     * or an AutoML Translation model.
+     * The value format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * If the map is empty or a specific model is
+     * not requested for a language pair, then default google model (nmt) is used.
+     * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetModels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearModels() { + internalGetMutableModels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Optional. The models to use for translation. Map's key is target language
+     * code. Map's value is model name. Value can be a built-in general model,
+     * or an AutoML Translation model.
+     * The value format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * If the map is empty or a specific model is
+     * not requested for a language pair, then default google model (nmt) is used.
+     * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder removeModels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableModels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableModels() { + return internalGetMutableModels().getMutableMap(); + } + /** + * + * + *
+     * Optional. The models to use for translation. Map's key is target language
+     * code. Map's value is model name. Value can be a built-in general model,
+     * or an AutoML Translation model.
+     * The value format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * If the map is empty or a specific model is
+     * not requested for a language pair, then default google model (nmt) is used.
+     * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putModels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableModels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Optional. The models to use for translation. Map's key is target language
+     * code. Map's value is model name. Value can be a built-in general model,
+     * or an AutoML Translation model.
+     * The value format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * If the map is empty or a specific model is
+     * not requested for a language pair, then default google model (nmt) is used.
+     * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putAllModels(java.util.Map values) { + internalGetMutableModels().getMutableMap().putAll(values); + return this; + } + + private java.util.List inputConfigs_ = + java.util.Collections.emptyList(); + + private void ensureInputConfigsIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + inputConfigs_ = + new java.util.ArrayList(inputConfigs_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.InputConfig, + com.google.cloud.translate.v3.InputConfig.Builder, + com.google.cloud.translate.v3.InputConfigOrBuilder> + inputConfigsBuilder_; + + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List getInputConfigsList() { + if (inputConfigsBuilder_ == null) { + return java.util.Collections.unmodifiableList(inputConfigs_); + } else { + return inputConfigsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getInputConfigsCount() { + if (inputConfigsBuilder_ == null) { + return inputConfigs_.size(); + } else { + return inputConfigsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.InputConfig getInputConfigs(int index) { + if (inputConfigsBuilder_ == null) { + return inputConfigs_.get(index); + } else { + return inputConfigsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInputConfigs(int index, com.google.cloud.translate.v3.InputConfig value) { + if (inputConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputConfigsIsMutable(); + inputConfigs_.set(index, value); + onChanged(); + } else { + inputConfigsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setInputConfigs( + int index, com.google.cloud.translate.v3.InputConfig.Builder builderForValue) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + inputConfigs_.set(index, builderForValue.build()); + onChanged(); + } else { + inputConfigsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addInputConfigs(com.google.cloud.translate.v3.InputConfig value) { + if (inputConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputConfigsIsMutable(); + inputConfigs_.add(value); + onChanged(); + } else { + inputConfigsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addInputConfigs(int index, com.google.cloud.translate.v3.InputConfig value) { + if (inputConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputConfigsIsMutable(); + inputConfigs_.add(index, value); + onChanged(); + } else { + inputConfigsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addInputConfigs( + com.google.cloud.translate.v3.InputConfig.Builder builderForValue) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + inputConfigs_.add(builderForValue.build()); + onChanged(); + } else { + inputConfigsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addInputConfigs( + int index, com.google.cloud.translate.v3.InputConfig.Builder builderForValue) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + inputConfigs_.add(index, builderForValue.build()); + onChanged(); + } else { + inputConfigsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addAllInputConfigs( + java.lang.Iterable values) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, inputConfigs_); + onChanged(); + } else { + inputConfigsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearInputConfigs() { + if (inputConfigsBuilder_ == null) { + inputConfigs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + inputConfigsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder removeInputConfigs(int index) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + inputConfigs_.remove(index); + onChanged(); + } else { + inputConfigsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.InputConfig.Builder getInputConfigsBuilder(int index) { + return getInputConfigsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.InputConfigOrBuilder getInputConfigsOrBuilder(int index) { + if (inputConfigsBuilder_ == null) { + return inputConfigs_.get(index); + } else { + return inputConfigsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getInputConfigsOrBuilderList() { + if (inputConfigsBuilder_ != null) { + return inputConfigsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(inputConfigs_); + } + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.InputConfig.Builder addInputConfigsBuilder() { + return getInputConfigsFieldBuilder() + .addBuilder(com.google.cloud.translate.v3.InputConfig.getDefaultInstance()); + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.InputConfig.Builder addInputConfigsBuilder(int index) { + return getInputConfigsFieldBuilder() + .addBuilder(index, com.google.cloud.translate.v3.InputConfig.getDefaultInstance()); + } + /** + * + * + *
+     * Required. Input configurations.
+     * The total number of files matched should be <= 1000.
+     * The total content size should be <= 100M Unicode codepoints.
+     * The files must use UTF-8 encoding.
+     * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getInputConfigsBuilderList() { + return getInputConfigsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.InputConfig, + com.google.cloud.translate.v3.InputConfig.Builder, + com.google.cloud.translate.v3.InputConfigOrBuilder> + getInputConfigsFieldBuilder() { + if (inputConfigsBuilder_ == null) { + inputConfigsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.InputConfig, + com.google.cloud.translate.v3.InputConfig.Builder, + com.google.cloud.translate.v3.InputConfigOrBuilder>( + inputConfigs_, ((bitField0_ & 0x00000010) != 0), getParentForChildren(), isClean()); + inputConfigs_ = null; + } + return inputConfigsBuilder_; + } + + private com.google.cloud.translate.v3.OutputConfig outputConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.OutputConfig, + com.google.cloud.translate.v3.OutputConfig.Builder, + com.google.cloud.translate.v3.OutputConfigOrBuilder> + outputConfigBuilder_; + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasOutputConfig() { + return outputConfigBuilder_ != null || outputConfig_ != null; + } + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.OutputConfig getOutputConfig() { + if (outputConfigBuilder_ == null) { + return outputConfig_ == null + ? com.google.cloud.translate.v3.OutputConfig.getDefaultInstance() + : outputConfig_; + } else { + return outputConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setOutputConfig(com.google.cloud.translate.v3.OutputConfig value) { + if (outputConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + outputConfig_ = value; + onChanged(); + } else { + outputConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setOutputConfig( + com.google.cloud.translate.v3.OutputConfig.Builder builderForValue) { + if (outputConfigBuilder_ == null) { + outputConfig_ = builderForValue.build(); + onChanged(); + } else { + outputConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeOutputConfig(com.google.cloud.translate.v3.OutputConfig value) { + if (outputConfigBuilder_ == null) { + if (outputConfig_ != null) { + outputConfig_ = + com.google.cloud.translate.v3.OutputConfig.newBuilder(outputConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + outputConfig_ = value; + } + onChanged(); + } else { + outputConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearOutputConfig() { + if (outputConfigBuilder_ == null) { + outputConfig_ = null; + onChanged(); + } else { + outputConfig_ = null; + outputConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.OutputConfig.Builder getOutputConfigBuilder() { + + onChanged(); + return getOutputConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.OutputConfigOrBuilder getOutputConfigOrBuilder() { + if (outputConfigBuilder_ != null) { + return outputConfigBuilder_.getMessageOrBuilder(); + } else { + return outputConfig_ == null + ? com.google.cloud.translate.v3.OutputConfig.getDefaultInstance() + : outputConfig_; + } + } + /** + * + * + *
+     * Required. Output configuration.
+     * If 2 input configs match to the same file (that is, same input path),
+     * we don't generate output for duplicate inputs.
+     * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.OutputConfig, + com.google.cloud.translate.v3.OutputConfig.Builder, + com.google.cloud.translate.v3.OutputConfigOrBuilder> + getOutputConfigFieldBuilder() { + if (outputConfigBuilder_ == null) { + outputConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.OutputConfig, + com.google.cloud.translate.v3.OutputConfig.Builder, + com.google.cloud.translate.v3.OutputConfigOrBuilder>( + getOutputConfig(), getParentForChildren(), isClean()); + outputConfig_ = null; + } + return outputConfigBuilder_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + glossaries_; + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + internalGetGlossaries() { + if (glossaries_ == null) { + return com.google.protobuf.MapField.emptyMapField( + GlossariesDefaultEntryHolder.defaultEntry); + } + return glossaries_; + } + + private com.google.protobuf.MapField< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + internalGetMutableGlossaries() { + onChanged(); + ; + if (glossaries_ == null) { + glossaries_ = + com.google.protobuf.MapField.newMapField(GlossariesDefaultEntryHolder.defaultEntry); + } + if (!glossaries_.isMutable()) { + glossaries_ = glossaries_.copy(); + } + return glossaries_; + } + + public int getGlossariesCount() { + return internalGetGlossaries().getMap().size(); + } + /** + * + * + *
+     * Optional. Glossaries to be applied for translation.
+     * It's keyed by target language code.
+     * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean containsGlossaries(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetGlossaries().getMap().containsKey(key); + } + /** Use {@link #getGlossariesMap()} instead. */ + @java.lang.Deprecated + public java.util.Map< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + getGlossaries() { + return getGlossariesMap(); + } + /** + * + * + *
+     * Optional. Glossaries to be applied for translation.
+     * It's keyed by target language code.
+     * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.Map< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + getGlossariesMap() { + return internalGetGlossaries().getMap(); + } + /** + * + * + *
+     * Optional. Glossaries to be applied for translation.
+     * It's keyed by target language code.
+     * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossariesOrDefault( + java.lang.String key, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map + map = internalGetGlossaries().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional. Glossaries to be applied for translation.
+     * It's keyed by target language code.
+     * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossariesOrThrow( + java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map + map = internalGetGlossaries().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearGlossaries() { + internalGetMutableGlossaries().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Optional. Glossaries to be applied for translation.
+     * It's keyed by target language code.
+     * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeGlossaries(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableGlossaries().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map< + java.lang.String, com.google.cloud.translate.v3.TranslateTextGlossaryConfig> + getMutableGlossaries() { + return internalGetMutableGlossaries().getMutableMap(); + } + /** + * + * + *
+     * Optional. Glossaries to be applied for translation.
+     * It's keyed by target language code.
+     * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putGlossaries( + java.lang.String key, com.google.cloud.translate.v3.TranslateTextGlossaryConfig value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableGlossaries().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Optional. Glossaries to be applied for translation.
+     * It's keyed by target language code.
+     * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putAllGlossaries( + java.util.Map + values) { + internalGetMutableGlossaries().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.BatchTranslateTextRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.BatchTranslateTextRequest) + private static final com.google.cloud.translate.v3.BatchTranslateTextRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.BatchTranslateTextRequest(); + } + + public static com.google.cloud.translate.v3.BatchTranslateTextRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchTranslateTextRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchTranslateTextRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.BatchTranslateTextRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateTextRequestOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateTextRequestOrBuilder.java new file mode 100644 index 00000000..89e5fa64 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/BatchTranslateTextRequestOrBuilder.java @@ -0,0 +1,502 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface BatchTranslateTextRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.BatchTranslateTextRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Location to make a call. Must refer to a caller's project.
+   * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+   * The `global` location is not supported for batch translation.
+   * Only AutoML Translation models or glossaries within the same region (have
+   * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+   * error is returned.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Location to make a call. Must refer to a caller's project.
+   * Format: `projects/{project-number-or-id}/locations/{location-id}`.
+   * The `global` location is not supported for batch translation.
+   * Only AutoML Translation models or glossaries within the same region (have
+   * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400)
+   * error is returned.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. Source language code.
+   * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + java.lang.String getSourceLanguageCode(); + /** + * + * + *
+   * Required. Source language code.
+   * 
+ * + * string source_language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.protobuf.ByteString getSourceLanguageCodeBytes(); + + /** + * + * + *
+   * Required. Specify up to 10 language codes here.
+   * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List getTargetLanguageCodesList(); + /** + * + * + *
+   * Required. Specify up to 10 language codes here.
+   * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + int getTargetLanguageCodesCount(); + /** + * + * + *
+   * Required. Specify up to 10 language codes here.
+   * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.lang.String getTargetLanguageCodes(int index); + /** + * + * + *
+   * Required. Specify up to 10 language codes here.
+   * 
+ * + * repeated string target_language_codes = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.protobuf.ByteString getTargetLanguageCodesBytes(int index); + + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getModelsCount(); + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + boolean containsModels(java.lang.String key); + /** Use {@link #getModelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getModels(); + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.util.Map getModelsMap(); + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getModelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * Optional. The models to use for translation. Map's key is target language
+   * code. Map's value is model name. Value can be a built-in general model,
+   * or an AutoML Translation model.
+   * The value format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * If the map is empty or a specific model is
+   * not requested for a language pair, then default google model (nmt) is used.
+   * 
+ * + * map<string, string> models = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getModelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List getInputConfigsList(); + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.translate.v3.InputConfig getInputConfigs(int index); + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + int getInputConfigsCount(); + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List + getInputConfigsOrBuilderList(); + /** + * + * + *
+   * Required. Input configurations.
+   * The total number of files matched should be <= 1000.
+   * The total content size should be <= 100M Unicode codepoints.
+   * The files must use UTF-8 encoding.
+   * 
+ * + * + * repeated .google.cloud.translation.v3.InputConfig input_configs = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.translate.v3.InputConfigOrBuilder getInputConfigsOrBuilder(int index); + + /** + * + * + *
+   * Required. Output configuration.
+   * If 2 input configs match to the same file (that is, same input path),
+   * we don't generate output for duplicate inputs.
+   * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + boolean hasOutputConfig(); + /** + * + * + *
+   * Required. Output configuration.
+   * If 2 input configs match to the same file (that is, same input path),
+   * we don't generate output for duplicate inputs.
+   * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.translate.v3.OutputConfig getOutputConfig(); + /** + * + * + *
+   * Required. Output configuration.
+   * If 2 input configs match to the same file (that is, same input path),
+   * we don't generate output for duplicate inputs.
+   * 
+ * + * + * .google.cloud.translation.v3.OutputConfig output_config = 6 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.translate.v3.OutputConfigOrBuilder getOutputConfigOrBuilder(); + + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getGlossariesCount(); + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean containsGlossaries(java.lang.String key); + /** Use {@link #getGlossariesMap()} instead. */ + @java.lang.Deprecated + java.util.Map + getGlossaries(); + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.Map + getGlossariesMap(); + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossariesOrDefault( + java.lang.String key, com.google.cloud.translate.v3.TranslateTextGlossaryConfig defaultValue); + /** + * + * + *
+   * Optional. Glossaries to be applied for translation.
+   * It's keyed by target language code.
+   * 
+ * + * + * map<string, .google.cloud.translation.v3.TranslateTextGlossaryConfig> glossaries = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossariesOrThrow( + java.lang.String key); + + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getLabelsCount(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryMetadata.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryMetadata.java new file mode 100644 index 00000000..895e25d5 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryMetadata.java @@ -0,0 +1,1230 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Stored in the
+ * [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]
+ * field returned by CreateGlossary.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.CreateGlossaryMetadata} + */ +public final class CreateGlossaryMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.CreateGlossaryMetadata) + CreateGlossaryMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateGlossaryMetadata.newBuilder() to construct. + private CreateGlossaryMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateGlossaryMetadata() { + name_ = ""; + state_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateGlossaryMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: + { + int rawValue = input.readEnum(); + + state_ = rawValue; + break; + } + case 26: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (submitTime_ != null) { + subBuilder = submitTime_.toBuilder(); + } + submitTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(submitTime_); + submitTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.CreateGlossaryMetadata.class, + com.google.cloud.translate.v3.CreateGlossaryMetadata.Builder.class); + } + + /** + * + * + *
+   * Enumerates the possible states that the creation request can be in.
+   * 
+ * + * Protobuf enum {@code google.cloud.translation.v3.CreateGlossaryMetadata.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Invalid.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * Request is being processed.
+     * 
+ * + * RUNNING = 1; + */ + RUNNING(1), + /** + * + * + *
+     * The glossary was successfully created.
+     * 
+ * + * SUCCEEDED = 2; + */ + SUCCEEDED(2), + /** + * + * + *
+     * Failed to create the glossary.
+     * 
+ * + * FAILED = 3; + */ + FAILED(3), + /** + * + * + *
+     * Request is in the process of being canceled after caller invoked
+     * longrunning.Operations.CancelOperation on the request id.
+     * 
+ * + * CANCELLING = 4; + */ + CANCELLING(4), + /** + * + * + *
+     * The glossary creation request was successfully canceled.
+     * 
+ * + * CANCELLED = 5; + */ + CANCELLED(5), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Invalid.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Request is being processed.
+     * 
+ * + * RUNNING = 1; + */ + public static final int RUNNING_VALUE = 1; + /** + * + * + *
+     * The glossary was successfully created.
+     * 
+ * + * SUCCEEDED = 2; + */ + public static final int SUCCEEDED_VALUE = 2; + /** + * + * + *
+     * Failed to create the glossary.
+     * 
+ * + * FAILED = 3; + */ + public static final int FAILED_VALUE = 3; + /** + * + * + *
+     * Request is in the process of being canceled after caller invoked
+     * longrunning.Operations.CancelOperation on the request id.
+     * 
+ * + * CANCELLING = 4; + */ + public static final int CANCELLING_VALUE = 4; + /** + * + * + *
+     * The glossary creation request was successfully canceled.
+     * 
+ * + * CANCELLED = 5; + */ + public static final int CANCELLED_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return RUNNING; + case 2: + return SUCCEEDED; + case 3: + return FAILED; + case 4: + return CANCELLING; + case 5: + return CANCELLED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.translate.v3.CreateGlossaryMetadata.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.translation.v3.CreateGlossaryMetadata.State) + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The name of the glossary that is being created.
+   * 
+ * + * string name = 1; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The name of the glossary that is being created.
+   * 
+ * + * string name = 1; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATE_FIELD_NUMBER = 2; + private int state_; + /** + * + * + *
+   * The current state of the glossary creation operation.
+   * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * The current state of the glossary creation operation.
+   * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + public com.google.cloud.translate.v3.CreateGlossaryMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.translate.v3.CreateGlossaryMetadata.State result = + com.google.cloud.translate.v3.CreateGlossaryMetadata.State.valueOf(state_); + return result == null + ? com.google.cloud.translate.v3.CreateGlossaryMetadata.State.UNRECOGNIZED + : result; + } + + public static final int SUBMIT_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp submitTime_; + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public boolean hasSubmitTime() { + return submitTime_ != null; + } + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + return submitTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : submitTime_; + } + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + return getSubmitTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (state_ + != com.google.cloud.translate.v3.CreateGlossaryMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, state_); + } + if (submitTime_ != null) { + output.writeMessage(3, getSubmitTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (state_ + != com.google.cloud.translate.v3.CreateGlossaryMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, state_); + } + if (submitTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getSubmitTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.CreateGlossaryMetadata)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.CreateGlossaryMetadata other = + (com.google.cloud.translate.v3.CreateGlossaryMetadata) obj; + + if (!getName().equals(other.getName())) return false; + if (state_ != other.state_) return false; + if (hasSubmitTime() != other.hasSubmitTime()) return false; + if (hasSubmitTime()) { + if (!getSubmitTime().equals(other.getSubmitTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasSubmitTime()) { + hash = (37 * hash) + SUBMIT_TIME_FIELD_NUMBER; + hash = (53 * hash) + getSubmitTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.CreateGlossaryMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Stored in the
+   * [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]
+   * field returned by CreateGlossary.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.CreateGlossaryMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.CreateGlossaryMetadata) + com.google.cloud.translate.v3.CreateGlossaryMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.CreateGlossaryMetadata.class, + com.google.cloud.translate.v3.CreateGlossaryMetadata.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.CreateGlossaryMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + state_ = 0; + + if (submitTimeBuilder_ == null) { + submitTime_ = null; + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.CreateGlossaryMetadata getDefaultInstanceForType() { + return com.google.cloud.translate.v3.CreateGlossaryMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.CreateGlossaryMetadata build() { + com.google.cloud.translate.v3.CreateGlossaryMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.CreateGlossaryMetadata buildPartial() { + com.google.cloud.translate.v3.CreateGlossaryMetadata result = + new com.google.cloud.translate.v3.CreateGlossaryMetadata(this); + result.name_ = name_; + result.state_ = state_; + if (submitTimeBuilder_ == null) { + result.submitTime_ = submitTime_; + } else { + result.submitTime_ = submitTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.CreateGlossaryMetadata) { + return mergeFrom((com.google.cloud.translate.v3.CreateGlossaryMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.CreateGlossaryMetadata other) { + if (other == com.google.cloud.translate.v3.CreateGlossaryMetadata.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasSubmitTime()) { + mergeSubmitTime(other.getSubmitTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.CreateGlossaryMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.CreateGlossaryMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The name of the glossary that is being created.
+     * 
+ * + * string name = 1; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The name of the glossary that is being created.
+     * 
+ * + * string name = 1; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The name of the glossary that is being created.
+     * 
+ * + * string name = 1; + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the glossary that is being created.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the glossary that is being created.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * The current state of the glossary creation operation.
+     * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * The current state of the glossary creation operation.
+     * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + public Builder setStateValue(int value) { + state_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The current state of the glossary creation operation.
+     * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + public com.google.cloud.translate.v3.CreateGlossaryMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.translate.v3.CreateGlossaryMetadata.State result = + com.google.cloud.translate.v3.CreateGlossaryMetadata.State.valueOf(state_); + return result == null + ? com.google.cloud.translate.v3.CreateGlossaryMetadata.State.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The current state of the glossary creation operation.
+     * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + public Builder setState(com.google.cloud.translate.v3.CreateGlossaryMetadata.State value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The current state of the glossary creation operation.
+     * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp submitTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + submitTimeBuilder_; + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public boolean hasSubmitTime() { + return submitTimeBuilder_ != null || submitTime_ != null; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + if (submitTimeBuilder_ == null) { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } else { + return submitTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + submitTime_ = value; + onChanged(); + } else { + submitTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (submitTimeBuilder_ == null) { + submitTime_ = builderForValue.build(); + onChanged(); + } else { + submitTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public Builder mergeSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (submitTime_ != null) { + submitTime_ = + com.google.protobuf.Timestamp.newBuilder(submitTime_).mergeFrom(value).buildPartial(); + } else { + submitTime_ = value; + } + onChanged(); + } else { + submitTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public Builder clearSubmitTime() { + if (submitTimeBuilder_ == null) { + submitTime_ = null; + onChanged(); + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getSubmitTimeBuilder() { + + onChanged(); + return getSubmitTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + if (submitTimeBuilder_ != null) { + return submitTimeBuilder_.getMessageOrBuilder(); + } else { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getSubmitTimeFieldBuilder() { + if (submitTimeBuilder_ == null) { + submitTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getSubmitTime(), getParentForChildren(), isClean()); + submitTime_ = null; + } + return submitTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.CreateGlossaryMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.CreateGlossaryMetadata) + private static final com.google.cloud.translate.v3.CreateGlossaryMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.CreateGlossaryMetadata(); + } + + public static com.google.cloud.translate.v3.CreateGlossaryMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateGlossaryMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateGlossaryMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.CreateGlossaryMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryMetadataOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryMetadataOrBuilder.java new file mode 100644 index 00000000..a3ac52d7 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryMetadataOrBuilder.java @@ -0,0 +1,98 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface CreateGlossaryMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.CreateGlossaryMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The name of the glossary that is being created.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + * + * + *
+   * The name of the glossary that is being created.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The current state of the glossary creation operation.
+   * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + int getStateValue(); + /** + * + * + *
+   * The current state of the glossary creation operation.
+   * 
+ * + * .google.cloud.translation.v3.CreateGlossaryMetadata.State state = 2; + */ + com.google.cloud.translate.v3.CreateGlossaryMetadata.State getState(); + + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + boolean hasSubmitTime(); + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + com.google.protobuf.Timestamp getSubmitTime(); + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryRequest.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryRequest.java new file mode 100644 index 00000000..0bdedf13 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryRequest.java @@ -0,0 +1,917 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Request message for CreateGlossary.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.CreateGlossaryRequest} + */ +public final class CreateGlossaryRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.CreateGlossaryRequest) + CreateGlossaryRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateGlossaryRequest.newBuilder() to construct. + private CreateGlossaryRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateGlossaryRequest() { + parent_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateGlossaryRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.translate.v3.Glossary.Builder subBuilder = null; + if (glossary_ != null) { + subBuilder = glossary_.toBuilder(); + } + glossary_ = + input.readMessage( + com.google.cloud.translate.v3.Glossary.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(glossary_); + glossary_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.CreateGlossaryRequest.class, + com.google.cloud.translate.v3.CreateGlossaryRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The project name.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The project name.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GLOSSARY_FIELD_NUMBER = 2; + private com.google.cloud.translate.v3.Glossary glossary_; + /** + * + * + *
+   * Required. The glossary to create.
+   * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasGlossary() { + return glossary_ != null; + } + /** + * + * + *
+   * Required. The glossary to create.
+   * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.Glossary getGlossary() { + return glossary_ == null + ? com.google.cloud.translate.v3.Glossary.getDefaultInstance() + : glossary_; + } + /** + * + * + *
+   * Required. The glossary to create.
+   * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.GlossaryOrBuilder getGlossaryOrBuilder() { + return getGlossary(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (glossary_ != null) { + output.writeMessage(2, getGlossary()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (glossary_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getGlossary()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.CreateGlossaryRequest)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.CreateGlossaryRequest other = + (com.google.cloud.translate.v3.CreateGlossaryRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasGlossary() != other.hasGlossary()) return false; + if (hasGlossary()) { + if (!getGlossary().equals(other.getGlossary())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasGlossary()) { + hash = (37 * hash) + GLOSSARY_FIELD_NUMBER; + hash = (53 * hash) + getGlossary().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.CreateGlossaryRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for CreateGlossary.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.CreateGlossaryRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.CreateGlossaryRequest) + com.google.cloud.translate.v3.CreateGlossaryRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.CreateGlossaryRequest.class, + com.google.cloud.translate.v3.CreateGlossaryRequest.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.CreateGlossaryRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (glossaryBuilder_ == null) { + glossary_ = null; + } else { + glossary_ = null; + glossaryBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_CreateGlossaryRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.CreateGlossaryRequest getDefaultInstanceForType() { + return com.google.cloud.translate.v3.CreateGlossaryRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.CreateGlossaryRequest build() { + com.google.cloud.translate.v3.CreateGlossaryRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.CreateGlossaryRequest buildPartial() { + com.google.cloud.translate.v3.CreateGlossaryRequest result = + new com.google.cloud.translate.v3.CreateGlossaryRequest(this); + result.parent_ = parent_; + if (glossaryBuilder_ == null) { + result.glossary_ = glossary_; + } else { + result.glossary_ = glossaryBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.CreateGlossaryRequest) { + return mergeFrom((com.google.cloud.translate.v3.CreateGlossaryRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.CreateGlossaryRequest other) { + if (other == com.google.cloud.translate.v3.CreateGlossaryRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasGlossary()) { + mergeGlossary(other.getGlossary()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.CreateGlossaryRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.CreateGlossaryRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The project name.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The project name.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The project name.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project name.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project name.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.translate.v3.Glossary glossary_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary, + com.google.cloud.translate.v3.Glossary.Builder, + com.google.cloud.translate.v3.GlossaryOrBuilder> + glossaryBuilder_; + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasGlossary() { + return glossaryBuilder_ != null || glossary_ != null; + } + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.Glossary getGlossary() { + if (glossaryBuilder_ == null) { + return glossary_ == null + ? com.google.cloud.translate.v3.Glossary.getDefaultInstance() + : glossary_; + } else { + return glossaryBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setGlossary(com.google.cloud.translate.v3.Glossary value) { + if (glossaryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + glossary_ = value; + onChanged(); + } else { + glossaryBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setGlossary(com.google.cloud.translate.v3.Glossary.Builder builderForValue) { + if (glossaryBuilder_ == null) { + glossary_ = builderForValue.build(); + onChanged(); + } else { + glossaryBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeGlossary(com.google.cloud.translate.v3.Glossary value) { + if (glossaryBuilder_ == null) { + if (glossary_ != null) { + glossary_ = + com.google.cloud.translate.v3.Glossary.newBuilder(glossary_) + .mergeFrom(value) + .buildPartial(); + } else { + glossary_ = value; + } + onChanged(); + } else { + glossaryBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearGlossary() { + if (glossaryBuilder_ == null) { + glossary_ = null; + onChanged(); + } else { + glossary_ = null; + glossaryBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.Glossary.Builder getGlossaryBuilder() { + + onChanged(); + return getGlossaryFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.translate.v3.GlossaryOrBuilder getGlossaryOrBuilder() { + if (glossaryBuilder_ != null) { + return glossaryBuilder_.getMessageOrBuilder(); + } else { + return glossary_ == null + ? com.google.cloud.translate.v3.Glossary.getDefaultInstance() + : glossary_; + } + } + /** + * + * + *
+     * Required. The glossary to create.
+     * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary, + com.google.cloud.translate.v3.Glossary.Builder, + com.google.cloud.translate.v3.GlossaryOrBuilder> + getGlossaryFieldBuilder() { + if (glossaryBuilder_ == null) { + glossaryBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary, + com.google.cloud.translate.v3.Glossary.Builder, + com.google.cloud.translate.v3.GlossaryOrBuilder>( + getGlossary(), getParentForChildren(), isClean()); + glossary_ = null; + } + return glossaryBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.CreateGlossaryRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.CreateGlossaryRequest) + private static final com.google.cloud.translate.v3.CreateGlossaryRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.CreateGlossaryRequest(); + } + + public static com.google.cloud.translate.v3.CreateGlossaryRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateGlossaryRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateGlossaryRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.CreateGlossaryRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryRequestOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryRequestOrBuilder.java new file mode 100644 index 00000000..a89646f8 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/CreateGlossaryRequestOrBuilder.java @@ -0,0 +1,87 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface CreateGlossaryRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.CreateGlossaryRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The project name.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The project name.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The glossary to create.
+   * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + boolean hasGlossary(); + /** + * + * + *
+   * Required. The glossary to create.
+   * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.translate.v3.Glossary getGlossary(); + /** + * + * + *
+   * Required. The glossary to create.
+   * 
+ * + * + * .google.cloud.translation.v3.Glossary glossary = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.translate.v3.GlossaryOrBuilder getGlossaryOrBuilder(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryMetadata.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryMetadata.java new file mode 100644 index 00000000..090b317b --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryMetadata.java @@ -0,0 +1,1230 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Stored in the
+ * [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]
+ * field returned by DeleteGlossary.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DeleteGlossaryMetadata} + */ +public final class DeleteGlossaryMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.DeleteGlossaryMetadata) + DeleteGlossaryMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteGlossaryMetadata.newBuilder() to construct. + private DeleteGlossaryMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteGlossaryMetadata() { + name_ = ""; + state_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteGlossaryMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: + { + int rawValue = input.readEnum(); + + state_ = rawValue; + break; + } + case 26: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (submitTime_ != null) { + subBuilder = submitTime_.toBuilder(); + } + submitTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(submitTime_); + submitTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DeleteGlossaryMetadata.class, + com.google.cloud.translate.v3.DeleteGlossaryMetadata.Builder.class); + } + + /** + * + * + *
+   * Enumerates the possible states that the creation request can be in.
+   * 
+ * + * Protobuf enum {@code google.cloud.translation.v3.DeleteGlossaryMetadata.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Invalid.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * Request is being processed.
+     * 
+ * + * RUNNING = 1; + */ + RUNNING(1), + /** + * + * + *
+     * The glossary was successfully deleted.
+     * 
+ * + * SUCCEEDED = 2; + */ + SUCCEEDED(2), + /** + * + * + *
+     * Failed to delete the glossary.
+     * 
+ * + * FAILED = 3; + */ + FAILED(3), + /** + * + * + *
+     * Request is in the process of being canceled after caller invoked
+     * longrunning.Operations.CancelOperation on the request id.
+     * 
+ * + * CANCELLING = 4; + */ + CANCELLING(4), + /** + * + * + *
+     * The glossary deletion request was successfully canceled.
+     * 
+ * + * CANCELLED = 5; + */ + CANCELLED(5), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Invalid.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Request is being processed.
+     * 
+ * + * RUNNING = 1; + */ + public static final int RUNNING_VALUE = 1; + /** + * + * + *
+     * The glossary was successfully deleted.
+     * 
+ * + * SUCCEEDED = 2; + */ + public static final int SUCCEEDED_VALUE = 2; + /** + * + * + *
+     * Failed to delete the glossary.
+     * 
+ * + * FAILED = 3; + */ + public static final int FAILED_VALUE = 3; + /** + * + * + *
+     * Request is in the process of being canceled after caller invoked
+     * longrunning.Operations.CancelOperation on the request id.
+     * 
+ * + * CANCELLING = 4; + */ + public static final int CANCELLING_VALUE = 4; + /** + * + * + *
+     * The glossary deletion request was successfully canceled.
+     * 
+ * + * CANCELLED = 5; + */ + public static final int CANCELLED_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return RUNNING; + case 2: + return SUCCEEDED; + case 3: + return FAILED; + case 4: + return CANCELLING; + case 5: + return CANCELLED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.translate.v3.DeleteGlossaryMetadata.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.translation.v3.DeleteGlossaryMetadata.State) + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The name of the glossary that is being deleted.
+   * 
+ * + * string name = 1; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The name of the glossary that is being deleted.
+   * 
+ * + * string name = 1; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATE_FIELD_NUMBER = 2; + private int state_; + /** + * + * + *
+   * The current state of the glossary deletion operation.
+   * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * The current state of the glossary deletion operation.
+   * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + public com.google.cloud.translate.v3.DeleteGlossaryMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.translate.v3.DeleteGlossaryMetadata.State result = + com.google.cloud.translate.v3.DeleteGlossaryMetadata.State.valueOf(state_); + return result == null + ? com.google.cloud.translate.v3.DeleteGlossaryMetadata.State.UNRECOGNIZED + : result; + } + + public static final int SUBMIT_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp submitTime_; + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public boolean hasSubmitTime() { + return submitTime_ != null; + } + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + return submitTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : submitTime_; + } + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + return getSubmitTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (state_ + != com.google.cloud.translate.v3.DeleteGlossaryMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, state_); + } + if (submitTime_ != null) { + output.writeMessage(3, getSubmitTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (state_ + != com.google.cloud.translate.v3.DeleteGlossaryMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, state_); + } + if (submitTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getSubmitTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.DeleteGlossaryMetadata)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.DeleteGlossaryMetadata other = + (com.google.cloud.translate.v3.DeleteGlossaryMetadata) obj; + + if (!getName().equals(other.getName())) return false; + if (state_ != other.state_) return false; + if (hasSubmitTime() != other.hasSubmitTime()) return false; + if (hasSubmitTime()) { + if (!getSubmitTime().equals(other.getSubmitTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasSubmitTime()) { + hash = (37 * hash) + SUBMIT_TIME_FIELD_NUMBER; + hash = (53 * hash) + getSubmitTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.DeleteGlossaryMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Stored in the
+   * [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]
+   * field returned by DeleteGlossary.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DeleteGlossaryMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.DeleteGlossaryMetadata) + com.google.cloud.translate.v3.DeleteGlossaryMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DeleteGlossaryMetadata.class, + com.google.cloud.translate.v3.DeleteGlossaryMetadata.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.DeleteGlossaryMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + state_ = 0; + + if (submitTimeBuilder_ == null) { + submitTime_ = null; + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryMetadata getDefaultInstanceForType() { + return com.google.cloud.translate.v3.DeleteGlossaryMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryMetadata build() { + com.google.cloud.translate.v3.DeleteGlossaryMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryMetadata buildPartial() { + com.google.cloud.translate.v3.DeleteGlossaryMetadata result = + new com.google.cloud.translate.v3.DeleteGlossaryMetadata(this); + result.name_ = name_; + result.state_ = state_; + if (submitTimeBuilder_ == null) { + result.submitTime_ = submitTime_; + } else { + result.submitTime_ = submitTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.DeleteGlossaryMetadata) { + return mergeFrom((com.google.cloud.translate.v3.DeleteGlossaryMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.DeleteGlossaryMetadata other) { + if (other == com.google.cloud.translate.v3.DeleteGlossaryMetadata.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasSubmitTime()) { + mergeSubmitTime(other.getSubmitTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.DeleteGlossaryMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.DeleteGlossaryMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The name of the glossary that is being deleted.
+     * 
+ * + * string name = 1; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The name of the glossary that is being deleted.
+     * 
+ * + * string name = 1; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The name of the glossary that is being deleted.
+     * 
+ * + * string name = 1; + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the glossary that is being deleted.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the glossary that is being deleted.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private int state_ = 0; + /** + * + * + *
+     * The current state of the glossary deletion operation.
+     * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * The current state of the glossary deletion operation.
+     * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + public Builder setStateValue(int value) { + state_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The current state of the glossary deletion operation.
+     * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + public com.google.cloud.translate.v3.DeleteGlossaryMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.translate.v3.DeleteGlossaryMetadata.State result = + com.google.cloud.translate.v3.DeleteGlossaryMetadata.State.valueOf(state_); + return result == null + ? com.google.cloud.translate.v3.DeleteGlossaryMetadata.State.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The current state of the glossary deletion operation.
+     * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + public Builder setState(com.google.cloud.translate.v3.DeleteGlossaryMetadata.State value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The current state of the glossary deletion operation.
+     * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp submitTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + submitTimeBuilder_; + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public boolean hasSubmitTime() { + return submitTimeBuilder_ != null || submitTime_ != null; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + if (submitTimeBuilder_ == null) { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } else { + return submitTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + submitTime_ = value; + onChanged(); + } else { + submitTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (submitTimeBuilder_ == null) { + submitTime_ = builderForValue.build(); + onChanged(); + } else { + submitTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public Builder mergeSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (submitTime_ != null) { + submitTime_ = + com.google.protobuf.Timestamp.newBuilder(submitTime_).mergeFrom(value).buildPartial(); + } else { + submitTime_ = value; + } + onChanged(); + } else { + submitTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public Builder clearSubmitTime() { + if (submitTimeBuilder_ == null) { + submitTime_ = null; + onChanged(); + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getSubmitTimeBuilder() { + + onChanged(); + return getSubmitTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + if (submitTimeBuilder_ != null) { + return submitTimeBuilder_.getMessageOrBuilder(); + } else { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getSubmitTimeFieldBuilder() { + if (submitTimeBuilder_ == null) { + submitTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getSubmitTime(), getParentForChildren(), isClean()); + submitTime_ = null; + } + return submitTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.DeleteGlossaryMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DeleteGlossaryMetadata) + private static final com.google.cloud.translate.v3.DeleteGlossaryMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.DeleteGlossaryMetadata(); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteGlossaryMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteGlossaryMetadata(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryMetadataOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryMetadataOrBuilder.java new file mode 100644 index 00000000..99df9368 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryMetadataOrBuilder.java @@ -0,0 +1,98 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface DeleteGlossaryMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.DeleteGlossaryMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The name of the glossary that is being deleted.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + * + * + *
+   * The name of the glossary that is being deleted.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The current state of the glossary deletion operation.
+   * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + int getStateValue(); + /** + * + * + *
+   * The current state of the glossary deletion operation.
+   * 
+ * + * .google.cloud.translation.v3.DeleteGlossaryMetadata.State state = 2; + */ + com.google.cloud.translate.v3.DeleteGlossaryMetadata.State getState(); + + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + boolean hasSubmitTime(); + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + com.google.protobuf.Timestamp getSubmitTime(); + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryRequest.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryRequest.java new file mode 100644 index 00000000..9af55e5e --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryRequest.java @@ -0,0 +1,627 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Request message for DeleteGlossary.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DeleteGlossaryRequest} + */ +public final class DeleteGlossaryRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.DeleteGlossaryRequest) + DeleteGlossaryRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteGlossaryRequest.newBuilder() to construct. + private DeleteGlossaryRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteGlossaryRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteGlossaryRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DeleteGlossaryRequest.class, + com.google.cloud.translate.v3.DeleteGlossaryRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the glossary to delete.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the glossary to delete.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.DeleteGlossaryRequest)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.DeleteGlossaryRequest other = + (com.google.cloud.translate.v3.DeleteGlossaryRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.DeleteGlossaryRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for DeleteGlossary.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DeleteGlossaryRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.DeleteGlossaryRequest) + com.google.cloud.translate.v3.DeleteGlossaryRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DeleteGlossaryRequest.class, + com.google.cloud.translate.v3.DeleteGlossaryRequest.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.DeleteGlossaryRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryRequest getDefaultInstanceForType() { + return com.google.cloud.translate.v3.DeleteGlossaryRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryRequest build() { + com.google.cloud.translate.v3.DeleteGlossaryRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryRequest buildPartial() { + com.google.cloud.translate.v3.DeleteGlossaryRequest result = + new com.google.cloud.translate.v3.DeleteGlossaryRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.DeleteGlossaryRequest) { + return mergeFrom((com.google.cloud.translate.v3.DeleteGlossaryRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.DeleteGlossaryRequest other) { + if (other == com.google.cloud.translate.v3.DeleteGlossaryRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.DeleteGlossaryRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.DeleteGlossaryRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the glossary to delete.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the glossary to delete.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the glossary to delete.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the glossary to delete.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the glossary to delete.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.DeleteGlossaryRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DeleteGlossaryRequest) + private static final com.google.cloud.translate.v3.DeleteGlossaryRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.DeleteGlossaryRequest(); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteGlossaryRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteGlossaryRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryRequestOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryRequestOrBuilder.java new file mode 100644 index 00000000..9333c273 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryRequestOrBuilder.java @@ -0,0 +1,50 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface DeleteGlossaryRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.DeleteGlossaryRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the glossary to delete.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the glossary to delete.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryResponse.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryResponse.java new file mode 100644 index 00000000..099a00ee --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryResponse.java @@ -0,0 +1,1159 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Stored in the
+ * [google.longrunning.Operation.response][google.longrunning.Operation.response]
+ * field returned by DeleteGlossary.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DeleteGlossaryResponse} + */ +public final class DeleteGlossaryResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.DeleteGlossaryResponse) + DeleteGlossaryResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteGlossaryResponse.newBuilder() to construct. + private DeleteGlossaryResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteGlossaryResponse() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteGlossaryResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (submitTime_ != null) { + subBuilder = submitTime_.toBuilder(); + } + submitTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(submitTime_); + submitTime_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (endTime_ != null) { + subBuilder = endTime_.toBuilder(); + } + endTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(endTime_); + endTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DeleteGlossaryResponse.class, + com.google.cloud.translate.v3.DeleteGlossaryResponse.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The name of the deleted glossary.
+   * 
+ * + * string name = 1; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The name of the deleted glossary.
+   * 
+ * + * string name = 1; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SUBMIT_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp submitTime_; + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public boolean hasSubmitTime() { + return submitTime_ != null; + } + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + return submitTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : submitTime_; + } + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + return getSubmitTime(); + } + + public static final int END_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+   * The time when the glossary deletion is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public boolean hasEndTime() { + return endTime_ != null; + } + /** + * + * + *
+   * The time when the glossary deletion is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+   * The time when the glossary deletion is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return getEndTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (submitTime_ != null) { + output.writeMessage(2, getSubmitTime()); + } + if (endTime_ != null) { + output.writeMessage(3, getEndTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (submitTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getSubmitTime()); + } + if (endTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getEndTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.DeleteGlossaryResponse)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.DeleteGlossaryResponse other = + (com.google.cloud.translate.v3.DeleteGlossaryResponse) obj; + + if (!getName().equals(other.getName())) return false; + if (hasSubmitTime() != other.hasSubmitTime()) return false; + if (hasSubmitTime()) { + if (!getSubmitTime().equals(other.getSubmitTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasSubmitTime()) { + hash = (37 * hash) + SUBMIT_TIME_FIELD_NUMBER; + hash = (53 * hash) + getSubmitTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.DeleteGlossaryResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Stored in the
+   * [google.longrunning.Operation.response][google.longrunning.Operation.response]
+   * field returned by DeleteGlossary.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DeleteGlossaryResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.DeleteGlossaryResponse) + com.google.cloud.translate.v3.DeleteGlossaryResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DeleteGlossaryResponse.class, + com.google.cloud.translate.v3.DeleteGlossaryResponse.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.DeleteGlossaryResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + if (submitTimeBuilder_ == null) { + submitTime_ = null; + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + if (endTimeBuilder_ == null) { + endTime_ = null; + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryResponse getDefaultInstanceForType() { + return com.google.cloud.translate.v3.DeleteGlossaryResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryResponse build() { + com.google.cloud.translate.v3.DeleteGlossaryResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryResponse buildPartial() { + com.google.cloud.translate.v3.DeleteGlossaryResponse result = + new com.google.cloud.translate.v3.DeleteGlossaryResponse(this); + result.name_ = name_; + if (submitTimeBuilder_ == null) { + result.submitTime_ = submitTime_; + } else { + result.submitTime_ = submitTimeBuilder_.build(); + } + if (endTimeBuilder_ == null) { + result.endTime_ = endTime_; + } else { + result.endTime_ = endTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.DeleteGlossaryResponse) { + return mergeFrom((com.google.cloud.translate.v3.DeleteGlossaryResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.DeleteGlossaryResponse other) { + if (other == com.google.cloud.translate.v3.DeleteGlossaryResponse.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasSubmitTime()) { + mergeSubmitTime(other.getSubmitTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.DeleteGlossaryResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.DeleteGlossaryResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The name of the deleted glossary.
+     * 
+ * + * string name = 1; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The name of the deleted glossary.
+     * 
+ * + * string name = 1; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The name of the deleted glossary.
+     * 
+ * + * string name = 1; + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the deleted glossary.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the deleted glossary.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp submitTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + submitTimeBuilder_; + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public boolean hasSubmitTime() { + return submitTimeBuilder_ != null || submitTime_ != null; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public com.google.protobuf.Timestamp getSubmitTime() { + if (submitTimeBuilder_ == null) { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } else { + return submitTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + submitTime_ = value; + onChanged(); + } else { + submitTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (submitTimeBuilder_ == null) { + submitTime_ = builderForValue.build(); + onChanged(); + } else { + submitTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public Builder mergeSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (submitTime_ != null) { + submitTime_ = + com.google.protobuf.Timestamp.newBuilder(submitTime_).mergeFrom(value).buildPartial(); + } else { + submitTime_ = value; + } + onChanged(); + } else { + submitTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public Builder clearSubmitTime() { + if (submitTimeBuilder_ == null) { + submitTime_ = null; + onChanged(); + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getSubmitTimeBuilder() { + + onChanged(); + return getSubmitTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + if (submitTimeBuilder_ != null) { + return submitTimeBuilder_.getMessageOrBuilder(); + } else { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } + } + /** + * + * + *
+     * The time when the operation was submitted to the server.
+     * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getSubmitTimeFieldBuilder() { + if (submitTimeBuilder_ == null) { + submitTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getSubmitTime(), getParentForChildren(), isClean()); + submitTime_ = null; + } + return submitTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public boolean hasEndTime() { + return endTimeBuilder_ != null || endTime_ != null; + } + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + onChanged(); + } else { + endTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + onChanged(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (endTime_ != null) { + endTime_ = + com.google.protobuf.Timestamp.newBuilder(endTime_).mergeFrom(value).buildPartial(); + } else { + endTime_ = value; + } + onChanged(); + } else { + endTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public Builder clearEndTime() { + if (endTimeBuilder_ == null) { + endTime_ = null; + onChanged(); + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+     * The time when the glossary deletion is finished and
+     * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+     * set to true.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.DeleteGlossaryResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DeleteGlossaryResponse) + private static final com.google.cloud.translate.v3.DeleteGlossaryResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.DeleteGlossaryResponse(); + } + + public static com.google.cloud.translate.v3.DeleteGlossaryResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteGlossaryResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteGlossaryResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DeleteGlossaryResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryResponseOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryResponseOrBuilder.java new file mode 100644 index 00000000..a6451557 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DeleteGlossaryResponseOrBuilder.java @@ -0,0 +1,114 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface DeleteGlossaryResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.DeleteGlossaryResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The name of the deleted glossary.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + * + * + *
+   * The name of the deleted glossary.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + boolean hasSubmitTime(); + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + com.google.protobuf.Timestamp getSubmitTime(); + /** + * + * + *
+   * The time when the operation was submitted to the server.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder(); + + /** + * + * + *
+   * The time when the glossary deletion is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + boolean hasEndTime(); + /** + * + * + *
+   * The time when the glossary deletion is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+   * The time when the glossary deletion is finished and
+   * [google.longrunning.Operation.done][google.longrunning.Operation.done] is
+   * set to true.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageRequest.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageRequest.java new file mode 100644 index 00000000..578fd698 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageRequest.java @@ -0,0 +1,1667 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The request message for language detection.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DetectLanguageRequest} + */ +public final class DetectLanguageRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.DetectLanguageRequest) + DetectLanguageRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DetectLanguageRequest.newBuilder() to construct. + private DetectLanguageRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DetectLanguageRequest() { + parent_ = ""; + model_ = ""; + mimeType_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DetectLanguageRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + sourceCase_ = 1; + source_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + mimeType_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + model_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 50: + { + if (!((mutable_bitField0_ & 0x00000010) != 0)) { + labels_ = + com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000010; + } + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageRequest_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 6: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DetectLanguageRequest.class, + com.google.cloud.translate.v3.DetectLanguageRequest.Builder.class); + } + + private int bitField0_; + private int sourceCase_ = 0; + private java.lang.Object source_; + + public enum SourceCase implements com.google.protobuf.Internal.EnumLite { + CONTENT(1), + SOURCE_NOT_SET(0); + private final int value; + + private SourceCase(int value) { + this.value = value; + } + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static SourceCase valueOf(int value) { + return forNumber(value); + } + + public static SourceCase forNumber(int value) { + switch (value) { + case 1: + return CONTENT; + case 0: + return SOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public static final int PARENT_FIELD_NUMBER = 5; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+   * `projects/{project-number-or-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Only models within the same region (has same location-id) can be used.
+   * Otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+   * `projects/{project-number-or-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Only models within the same region (has same location-id) can be used.
+   * Otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MODEL_FIELD_NUMBER = 4; + private volatile java.lang.Object model_; + /** + * + * + *
+   * Optional. The language detection model to be used.
+   * Format:
+   * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+   * Only one language detection model is currently supported:
+   * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+   * If not specified, the default model is used.
+   * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The language detection model to be used.
+   * Format:
+   * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+   * Only one language detection model is currently supported:
+   * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+   * If not specified, the default model is used.
+   * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTENT_FIELD_NUMBER = 1; + /** + * + * + *
+   * The content of the input stored as a string.
+   * 
+ * + * string content = 1; + */ + public java.lang.String getContent() { + java.lang.Object ref = ""; + if (sourceCase_ == 1) { + ref = source_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (sourceCase_ == 1) { + source_ = s; + } + return s; + } + } + /** + * + * + *
+   * The content of the input stored as a string.
+   * 
+ * + * string content = 1; + */ + public com.google.protobuf.ByteString getContentBytes() { + java.lang.Object ref = ""; + if (sourceCase_ == 1) { + ref = source_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (sourceCase_ == 1) { + source_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MIME_TYPE_FIELD_NUMBER = 3; + private volatile java.lang.Object mimeType_; + /** + * + * + *
+   * Optional. The format of the source text, for example, "text/html",
+   * "text/plain". If left blank, the MIME type defaults to "text/html".
+   * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The format of the source text, for example, "text/html",
+   * "text/plain". If left blank, the MIME type defaults to "text/html".
+   * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LABELS_FIELD_NUMBER = 6; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageRequest_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (sourceCase_ == 1) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, source_); + } + if (!getMimeTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, mimeType_); + } + if (!getModelBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, model_); + } + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, parent_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 6); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sourceCase_ == 1) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, source_); + } + if (!getMimeTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, mimeType_); + } + if (!getModelBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, model_); + } + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, parent_); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, labels__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.DetectLanguageRequest)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.DetectLanguageRequest other = + (com.google.cloud.translate.v3.DetectLanguageRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getModel().equals(other.getModel())) return false; + if (!getMimeType().equals(other.getMimeType())) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!getSourceCase().equals(other.getSourceCase())) return false; + switch (sourceCase_) { + case 1: + if (!getContent().equals(other.getContent())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + MODEL_FIELD_NUMBER; + hash = (53 * hash) + getModel().hashCode(); + hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getMimeType().hashCode(); + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + switch (sourceCase_) { + case 1: + hash = (37 * hash) + CONTENT_FIELD_NUMBER; + hash = (53 * hash) + getContent().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.DetectLanguageRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request message for language detection.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DetectLanguageRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.DetectLanguageRequest) + com.google.cloud.translate.v3.DetectLanguageRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageRequest_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 6: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 6: + return internalGetMutableLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DetectLanguageRequest.class, + com.google.cloud.translate.v3.DetectLanguageRequest.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.DetectLanguageRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + model_ = ""; + + mimeType_ = ""; + + internalGetMutableLabels().clear(); + sourceCase_ = 0; + source_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectLanguageRequest getDefaultInstanceForType() { + return com.google.cloud.translate.v3.DetectLanguageRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectLanguageRequest build() { + com.google.cloud.translate.v3.DetectLanguageRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectLanguageRequest buildPartial() { + com.google.cloud.translate.v3.DetectLanguageRequest result = + new com.google.cloud.translate.v3.DetectLanguageRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.parent_ = parent_; + result.model_ = model_; + if (sourceCase_ == 1) { + result.source_ = source_; + } + result.mimeType_ = mimeType_; + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.bitField0_ = to_bitField0_; + result.sourceCase_ = sourceCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.DetectLanguageRequest) { + return mergeFrom((com.google.cloud.translate.v3.DetectLanguageRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.DetectLanguageRequest other) { + if (other == com.google.cloud.translate.v3.DetectLanguageRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getModel().isEmpty()) { + model_ = other.model_; + onChanged(); + } + if (!other.getMimeType().isEmpty()) { + mimeType_ = other.mimeType_; + onChanged(); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + switch (other.getSourceCase()) { + case CONTENT: + { + sourceCase_ = 1; + source_ = other.source_; + onChanged(); + break; + } + case SOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.DetectLanguageRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.DetectLanguageRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public Builder clearSource() { + sourceCase_ = 0; + source_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+     * `projects/{project-number-or-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Only models within the same region (has same location-id) can be used.
+     * Otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+     * `projects/{project-number-or-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Only models within the same region (has same location-id) can be used.
+     * Otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+     * `projects/{project-number-or-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Only models within the same region (has same location-id) can be used.
+     * Otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+     * `projects/{project-number-or-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Only models within the same region (has same location-id) can be used.
+     * Otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+     * `projects/{project-number-or-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Only models within the same region (has same location-id) can be used.
+     * Otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object model_ = ""; + /** + * + * + *
+     * Optional. The language detection model to be used.
+     * Format:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+     * Only one language detection model is currently supported:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+     * If not specified, the default model is used.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The language detection model to be used.
+     * Format:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+     * Only one language detection model is currently supported:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+     * If not specified, the default model is used.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The language detection model to be used.
+     * Format:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+     * Only one language detection model is currently supported:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+     * If not specified, the default model is used.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setModel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + model_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The language detection model to be used.
+     * Format:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+     * Only one language detection model is currently supported:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+     * If not specified, the default model is used.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearModel() { + + model_ = getDefaultInstance().getModel(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The language detection model to be used.
+     * Format:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+     * Only one language detection model is currently supported:
+     * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+     * If not specified, the default model is used.
+     * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setModelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + model_ = value; + onChanged(); + return this; + } + + /** + * + * + *
+     * The content of the input stored as a string.
+     * 
+ * + * string content = 1; + */ + public java.lang.String getContent() { + java.lang.Object ref = ""; + if (sourceCase_ == 1) { + ref = source_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (sourceCase_ == 1) { + source_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The content of the input stored as a string.
+     * 
+ * + * string content = 1; + */ + public com.google.protobuf.ByteString getContentBytes() { + java.lang.Object ref = ""; + if (sourceCase_ == 1) { + ref = source_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + if (sourceCase_ == 1) { + source_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The content of the input stored as a string.
+     * 
+ * + * string content = 1; + */ + public Builder setContent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + sourceCase_ = 1; + source_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The content of the input stored as a string.
+     * 
+ * + * string content = 1; + */ + public Builder clearContent() { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The content of the input stored as a string.
+     * 
+ * + * string content = 1; + */ + public Builder setContentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + sourceCase_ = 1; + source_ = value; + onChanged(); + return this; + } + + private java.lang.Object mimeType_ = ""; + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     * "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     * "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     * "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setMimeType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + mimeType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     * "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearMimeType() { + + mimeType_ = getDefaultInstance().getMimeType(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     * "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setMimeTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + mimeType_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.DetectLanguageRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DetectLanguageRequest) + private static final com.google.cloud.translate.v3.DetectLanguageRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.DetectLanguageRequest(); + } + + public static com.google.cloud.translate.v3.DetectLanguageRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DetectLanguageRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DetectLanguageRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectLanguageRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageRequestOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageRequestOrBuilder.java new file mode 100644 index 00000000..fa17dadd --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageRequestOrBuilder.java @@ -0,0 +1,220 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface DetectLanguageRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.DetectLanguageRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+   * `projects/{project-number-or-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Only models within the same region (has same location-id) can be used.
+   * Otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}/locations/{location-id}` or
+   * `projects/{project-number-or-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Only models within the same region (has same location-id) can be used.
+   * Otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 5 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. The language detection model to be used.
+   * Format:
+   * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+   * Only one language detection model is currently supported:
+   * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+   * If not specified, the default model is used.
+   * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getModel(); + /** + * + * + *
+   * Optional. The language detection model to be used.
+   * Format:
+   * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
+   * Only one language detection model is currently supported:
+   * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`.
+   * If not specified, the default model is used.
+   * 
+ * + * string model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getModelBytes(); + + /** + * + * + *
+   * The content of the input stored as a string.
+   * 
+ * + * string content = 1; + */ + java.lang.String getContent(); + /** + * + * + *
+   * The content of the input stored as a string.
+   * 
+ * + * string content = 1; + */ + com.google.protobuf.ByteString getContentBytes(); + + /** + * + * + *
+   * Optional. The format of the source text, for example, "text/html",
+   * "text/plain". If left blank, the MIME type defaults to "text/html".
+   * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getMimeType(); + /** + * + * + *
+   * Optional. The format of the source text, for example, "text/html",
+   * "text/plain". If left blank, the MIME type defaults to "text/html".
+   * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getMimeTypeBytes(); + + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getLabelsCount(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); + + public com.google.cloud.translate.v3.DetectLanguageRequest.SourceCase getSourceCase(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageResponse.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageResponse.java new file mode 100644 index 00000000..71490eaa --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageResponse.java @@ -0,0 +1,965 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The response message for language detection.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DetectLanguageResponse} + */ +public final class DetectLanguageResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.DetectLanguageResponse) + DetectLanguageResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use DetectLanguageResponse.newBuilder() to construct. + private DetectLanguageResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DetectLanguageResponse() { + languages_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DetectLanguageResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + languages_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + languages_.add( + input.readMessage( + com.google.cloud.translate.v3.DetectedLanguage.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + languages_ = java.util.Collections.unmodifiableList(languages_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DetectLanguageResponse.class, + com.google.cloud.translate.v3.DetectLanguageResponse.Builder.class); + } + + public static final int LANGUAGES_FIELD_NUMBER = 1; + private java.util.List languages_; + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public java.util.List getLanguagesList() { + return languages_; + } + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public java.util.List + getLanguagesOrBuilderList() { + return languages_; + } + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public int getLanguagesCount() { + return languages_.size(); + } + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.DetectedLanguage getLanguages(int index) { + return languages_.get(index); + } + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.DetectedLanguageOrBuilder getLanguagesOrBuilder(int index) { + return languages_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < languages_.size(); i++) { + output.writeMessage(1, languages_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < languages_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, languages_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.DetectLanguageResponse)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.DetectLanguageResponse other = + (com.google.cloud.translate.v3.DetectLanguageResponse) obj; + + if (!getLanguagesList().equals(other.getLanguagesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getLanguagesCount() > 0) { + hash = (37 * hash) + LANGUAGES_FIELD_NUMBER; + hash = (53 * hash) + getLanguagesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.DetectLanguageResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The response message for language detection.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DetectLanguageResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.DetectLanguageResponse) + com.google.cloud.translate.v3.DetectLanguageResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DetectLanguageResponse.class, + com.google.cloud.translate.v3.DetectLanguageResponse.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.DetectLanguageResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getLanguagesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (languagesBuilder_ == null) { + languages_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + languagesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectLanguageResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectLanguageResponse getDefaultInstanceForType() { + return com.google.cloud.translate.v3.DetectLanguageResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectLanguageResponse build() { + com.google.cloud.translate.v3.DetectLanguageResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectLanguageResponse buildPartial() { + com.google.cloud.translate.v3.DetectLanguageResponse result = + new com.google.cloud.translate.v3.DetectLanguageResponse(this); + int from_bitField0_ = bitField0_; + if (languagesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + languages_ = java.util.Collections.unmodifiableList(languages_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.languages_ = languages_; + } else { + result.languages_ = languagesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.DetectLanguageResponse) { + return mergeFrom((com.google.cloud.translate.v3.DetectLanguageResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.DetectLanguageResponse other) { + if (other == com.google.cloud.translate.v3.DetectLanguageResponse.getDefaultInstance()) + return this; + if (languagesBuilder_ == null) { + if (!other.languages_.isEmpty()) { + if (languages_.isEmpty()) { + languages_ = other.languages_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLanguagesIsMutable(); + languages_.addAll(other.languages_); + } + onChanged(); + } + } else { + if (!other.languages_.isEmpty()) { + if (languagesBuilder_.isEmpty()) { + languagesBuilder_.dispose(); + languagesBuilder_ = null; + languages_ = other.languages_; + bitField0_ = (bitField0_ & ~0x00000001); + languagesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getLanguagesFieldBuilder() + : null; + } else { + languagesBuilder_.addAllMessages(other.languages_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.DetectLanguageResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.DetectLanguageResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List languages_ = + java.util.Collections.emptyList(); + + private void ensureLanguagesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + languages_ = + new java.util.ArrayList(languages_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.DetectedLanguage, + com.google.cloud.translate.v3.DetectedLanguage.Builder, + com.google.cloud.translate.v3.DetectedLanguageOrBuilder> + languagesBuilder_; + + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public java.util.List getLanguagesList() { + if (languagesBuilder_ == null) { + return java.util.Collections.unmodifiableList(languages_); + } else { + return languagesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public int getLanguagesCount() { + if (languagesBuilder_ == null) { + return languages_.size(); + } else { + return languagesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.DetectedLanguage getLanguages(int index) { + if (languagesBuilder_ == null) { + return languages_.get(index); + } else { + return languagesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder setLanguages(int index, com.google.cloud.translate.v3.DetectedLanguage value) { + if (languagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguagesIsMutable(); + languages_.set(index, value); + onChanged(); + } else { + languagesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder setLanguages( + int index, com.google.cloud.translate.v3.DetectedLanguage.Builder builderForValue) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + languages_.set(index, builderForValue.build()); + onChanged(); + } else { + languagesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder addLanguages(com.google.cloud.translate.v3.DetectedLanguage value) { + if (languagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguagesIsMutable(); + languages_.add(value); + onChanged(); + } else { + languagesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder addLanguages(int index, com.google.cloud.translate.v3.DetectedLanguage value) { + if (languagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguagesIsMutable(); + languages_.add(index, value); + onChanged(); + } else { + languagesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder addLanguages( + com.google.cloud.translate.v3.DetectedLanguage.Builder builderForValue) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + languages_.add(builderForValue.build()); + onChanged(); + } else { + languagesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder addLanguages( + int index, com.google.cloud.translate.v3.DetectedLanguage.Builder builderForValue) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + languages_.add(index, builderForValue.build()); + onChanged(); + } else { + languagesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder addAllLanguages( + java.lang.Iterable values) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, languages_); + onChanged(); + } else { + languagesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder clearLanguages() { + if (languagesBuilder_ == null) { + languages_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + languagesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public Builder removeLanguages(int index) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + languages_.remove(index); + onChanged(); + } else { + languagesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.DetectedLanguage.Builder getLanguagesBuilder(int index) { + return getLanguagesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.DetectedLanguageOrBuilder getLanguagesOrBuilder( + int index) { + if (languagesBuilder_ == null) { + return languages_.get(index); + } else { + return languagesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public java.util.List + getLanguagesOrBuilderList() { + if (languagesBuilder_ != null) { + return languagesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(languages_); + } + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.DetectedLanguage.Builder addLanguagesBuilder() { + return getLanguagesFieldBuilder() + .addBuilder(com.google.cloud.translate.v3.DetectedLanguage.getDefaultInstance()); + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.DetectedLanguage.Builder addLanguagesBuilder(int index) { + return getLanguagesFieldBuilder() + .addBuilder(index, com.google.cloud.translate.v3.DetectedLanguage.getDefaultInstance()); + } + /** + * + * + *
+     * A list of detected languages sorted by detection confidence in descending
+     * order. The most probable language first.
+     * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + public java.util.List + getLanguagesBuilderList() { + return getLanguagesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.DetectedLanguage, + com.google.cloud.translate.v3.DetectedLanguage.Builder, + com.google.cloud.translate.v3.DetectedLanguageOrBuilder> + getLanguagesFieldBuilder() { + if (languagesBuilder_ == null) { + languagesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.DetectedLanguage, + com.google.cloud.translate.v3.DetectedLanguage.Builder, + com.google.cloud.translate.v3.DetectedLanguageOrBuilder>( + languages_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + languages_ = null; + } + return languagesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.DetectLanguageResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DetectLanguageResponse) + private static final com.google.cloud.translate.v3.DetectLanguageResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.DetectLanguageResponse(); + } + + public static com.google.cloud.translate.v3.DetectLanguageResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DetectLanguageResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DetectLanguageResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectLanguageResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageResponseOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageResponseOrBuilder.java new file mode 100644 index 00000000..17c1f939 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectLanguageResponseOrBuilder.java @@ -0,0 +1,82 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface DetectLanguageResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.DetectLanguageResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + java.util.List getLanguagesList(); + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + com.google.cloud.translate.v3.DetectedLanguage getLanguages(int index); + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + int getLanguagesCount(); + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + java.util.List + getLanguagesOrBuilderList(); + /** + * + * + *
+   * A list of detected languages sorted by detection confidence in descending
+   * order. The most probable language first.
+   * 
+ * + * repeated .google.cloud.translation.v3.DetectedLanguage languages = 1; + */ + com.google.cloud.translate.v3.DetectedLanguageOrBuilder getLanguagesOrBuilder(int index); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectedLanguage.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectedLanguage.java new file mode 100644 index 00000000..287dc773 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectedLanguage.java @@ -0,0 +1,698 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The response message for language detection.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DetectedLanguage} + */ +public final class DetectedLanguage extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.DetectedLanguage) + DetectedLanguageOrBuilder { + private static final long serialVersionUID = 0L; + // Use DetectedLanguage.newBuilder() to construct. + private DetectedLanguage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DetectedLanguage() { + languageCode_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DetectedLanguage( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + languageCode_ = s; + break; + } + case 21: + { + confidence_ = input.readFloat(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectedLanguage_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectedLanguage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DetectedLanguage.class, + com.google.cloud.translate.v3.DetectedLanguage.Builder.class); + } + + public static final int LANGUAGE_CODE_FIELD_NUMBER = 1; + private volatile java.lang.Object languageCode_; + /** + * + * + *
+   * The BCP-47 language code of source content in the request, detected
+   * automatically.
+   * 
+ * + * string language_code = 1; + */ + public java.lang.String getLanguageCode() { + java.lang.Object ref = languageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageCode_ = s; + return s; + } + } + /** + * + * + *
+   * The BCP-47 language code of source content in the request, detected
+   * automatically.
+   * 
+ * + * string language_code = 1; + */ + public com.google.protobuf.ByteString getLanguageCodeBytes() { + java.lang.Object ref = languageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIDENCE_FIELD_NUMBER = 2; + private float confidence_; + /** + * + * + *
+   * The confidence of the detection result for this language.
+   * 
+ * + * float confidence = 2; + */ + public float getConfidence() { + return confidence_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, languageCode_); + } + if (confidence_ != 0F) { + output.writeFloat(2, confidence_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, languageCode_); + } + if (confidence_ != 0F) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, confidence_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.DetectedLanguage)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.DetectedLanguage other = + (com.google.cloud.translate.v3.DetectedLanguage) obj; + + if (!getLanguageCode().equals(other.getLanguageCode())) return false; + if (java.lang.Float.floatToIntBits(getConfidence()) + != java.lang.Float.floatToIntBits(other.getConfidence())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getLanguageCode().hashCode(); + hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.DetectedLanguage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.DetectedLanguage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The response message for language detection.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.DetectedLanguage} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.DetectedLanguage) + com.google.cloud.translate.v3.DetectedLanguageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectedLanguage_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectedLanguage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.DetectedLanguage.class, + com.google.cloud.translate.v3.DetectedLanguage.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.DetectedLanguage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + languageCode_ = ""; + + confidence_ = 0F; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_DetectedLanguage_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectedLanguage getDefaultInstanceForType() { + return com.google.cloud.translate.v3.DetectedLanguage.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectedLanguage build() { + com.google.cloud.translate.v3.DetectedLanguage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectedLanguage buildPartial() { + com.google.cloud.translate.v3.DetectedLanguage result = + new com.google.cloud.translate.v3.DetectedLanguage(this); + result.languageCode_ = languageCode_; + result.confidence_ = confidence_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.DetectedLanguage) { + return mergeFrom((com.google.cloud.translate.v3.DetectedLanguage) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.DetectedLanguage other) { + if (other == com.google.cloud.translate.v3.DetectedLanguage.getDefaultInstance()) return this; + if (!other.getLanguageCode().isEmpty()) { + languageCode_ = other.languageCode_; + onChanged(); + } + if (other.getConfidence() != 0F) { + setConfidence(other.getConfidence()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.DetectedLanguage parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.DetectedLanguage) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object languageCode_ = ""; + /** + * + * + *
+     * The BCP-47 language code of source content in the request, detected
+     * automatically.
+     * 
+ * + * string language_code = 1; + */ + public java.lang.String getLanguageCode() { + java.lang.Object ref = languageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The BCP-47 language code of source content in the request, detected
+     * automatically.
+     * 
+ * + * string language_code = 1; + */ + public com.google.protobuf.ByteString getLanguageCodeBytes() { + java.lang.Object ref = languageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The BCP-47 language code of source content in the request, detected
+     * automatically.
+     * 
+ * + * string language_code = 1; + */ + public Builder setLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + languageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The BCP-47 language code of source content in the request, detected
+     * automatically.
+     * 
+ * + * string language_code = 1; + */ + public Builder clearLanguageCode() { + + languageCode_ = getDefaultInstance().getLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * The BCP-47 language code of source content in the request, detected
+     * automatically.
+     * 
+ * + * string language_code = 1; + */ + public Builder setLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + languageCode_ = value; + onChanged(); + return this; + } + + private float confidence_; + /** + * + * + *
+     * The confidence of the detection result for this language.
+     * 
+ * + * float confidence = 2; + */ + public float getConfidence() { + return confidence_; + } + /** + * + * + *
+     * The confidence of the detection result for this language.
+     * 
+ * + * float confidence = 2; + */ + public Builder setConfidence(float value) { + + confidence_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The confidence of the detection result for this language.
+     * 
+ * + * float confidence = 2; + */ + public Builder clearConfidence() { + + confidence_ = 0F; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.DetectedLanguage) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.DetectedLanguage) + private static final com.google.cloud.translate.v3.DetectedLanguage DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.DetectedLanguage(); + } + + public static com.google.cloud.translate.v3.DetectedLanguage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DetectedLanguage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DetectedLanguage(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.DetectedLanguage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectedLanguageOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectedLanguageOrBuilder.java new file mode 100644 index 00000000..0f4d94e3 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/DetectedLanguageOrBuilder.java @@ -0,0 +1,59 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface DetectedLanguageOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.DetectedLanguage) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The BCP-47 language code of source content in the request, detected
+   * automatically.
+   * 
+ * + * string language_code = 1; + */ + java.lang.String getLanguageCode(); + /** + * + * + *
+   * The BCP-47 language code of source content in the request, detected
+   * automatically.
+   * 
+ * + * string language_code = 1; + */ + com.google.protobuf.ByteString getLanguageCodeBytes(); + + /** + * + * + *
+   * The confidence of the detection result for this language.
+   * 
+ * + * float confidence = 2; + */ + float getConfidence(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsDestination.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsDestination.java new file mode 100644 index 00000000..2e17fb91 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsDestination.java @@ -0,0 +1,625 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The Google Cloud Storage location for the output content.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GcsDestination} + */ +public final class GcsDestination extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.GcsDestination) + GcsDestinationOrBuilder { + private static final long serialVersionUID = 0L; + // Use GcsDestination.newBuilder() to construct. + private GcsDestination(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GcsDestination() { + outputUriPrefix_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GcsDestination( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + outputUriPrefix_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsDestination_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsDestination_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GcsDestination.class, + com.google.cloud.translate.v3.GcsDestination.Builder.class); + } + + public static final int OUTPUT_URI_PREFIX_FIELD_NUMBER = 1; + private volatile java.lang.Object outputUriPrefix_; + /** + * + * + *
+   * Required. There must be no files under 'output_uri_prefix'.
+   * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+   * INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * string output_uri_prefix = 1; + */ + public java.lang.String getOutputUriPrefix() { + java.lang.Object ref = outputUriPrefix_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + outputUriPrefix_ = s; + return s; + } + } + /** + * + * + *
+   * Required. There must be no files under 'output_uri_prefix'.
+   * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+   * INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * string output_uri_prefix = 1; + */ + public com.google.protobuf.ByteString getOutputUriPrefixBytes() { + java.lang.Object ref = outputUriPrefix_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + outputUriPrefix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getOutputUriPrefixBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, outputUriPrefix_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getOutputUriPrefixBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, outputUriPrefix_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.GcsDestination)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.GcsDestination other = + (com.google.cloud.translate.v3.GcsDestination) obj; + + if (!getOutputUriPrefix().equals(other.getOutputUriPrefix())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + OUTPUT_URI_PREFIX_FIELD_NUMBER; + hash = (53 * hash) + getOutputUriPrefix().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsDestination parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GcsDestination parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GcsDestination parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.GcsDestination prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The Google Cloud Storage location for the output content.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GcsDestination} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.GcsDestination) + com.google.cloud.translate.v3.GcsDestinationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsDestination_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsDestination_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GcsDestination.class, + com.google.cloud.translate.v3.GcsDestination.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.GcsDestination.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + outputUriPrefix_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsDestination_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GcsDestination getDefaultInstanceForType() { + return com.google.cloud.translate.v3.GcsDestination.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.GcsDestination build() { + com.google.cloud.translate.v3.GcsDestination result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GcsDestination buildPartial() { + com.google.cloud.translate.v3.GcsDestination result = + new com.google.cloud.translate.v3.GcsDestination(this); + result.outputUriPrefix_ = outputUriPrefix_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.GcsDestination) { + return mergeFrom((com.google.cloud.translate.v3.GcsDestination) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.GcsDestination other) { + if (other == com.google.cloud.translate.v3.GcsDestination.getDefaultInstance()) return this; + if (!other.getOutputUriPrefix().isEmpty()) { + outputUriPrefix_ = other.outputUriPrefix_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.GcsDestination parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.GcsDestination) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object outputUriPrefix_ = ""; + /** + * + * + *
+     * Required. There must be no files under 'output_uri_prefix'.
+     * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+     * INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * string output_uri_prefix = 1; + */ + public java.lang.String getOutputUriPrefix() { + java.lang.Object ref = outputUriPrefix_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + outputUriPrefix_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. There must be no files under 'output_uri_prefix'.
+     * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+     * INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * string output_uri_prefix = 1; + */ + public com.google.protobuf.ByteString getOutputUriPrefixBytes() { + java.lang.Object ref = outputUriPrefix_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + outputUriPrefix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. There must be no files under 'output_uri_prefix'.
+     * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+     * INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * string output_uri_prefix = 1; + */ + public Builder setOutputUriPrefix(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + outputUriPrefix_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. There must be no files under 'output_uri_prefix'.
+     * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+     * INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * string output_uri_prefix = 1; + */ + public Builder clearOutputUriPrefix() { + + outputUriPrefix_ = getDefaultInstance().getOutputUriPrefix(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. There must be no files under 'output_uri_prefix'.
+     * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+     * INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * string output_uri_prefix = 1; + */ + public Builder setOutputUriPrefixBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + outputUriPrefix_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.GcsDestination) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GcsDestination) + private static final com.google.cloud.translate.v3.GcsDestination DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.GcsDestination(); + } + + public static com.google.cloud.translate.v3.GcsDestination getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GcsDestination parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GcsDestination(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GcsDestination getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsDestinationOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsDestinationOrBuilder.java new file mode 100644 index 00000000..1cc63a69 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsDestinationOrBuilder.java @@ -0,0 +1,50 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface GcsDestinationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.GcsDestination) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. There must be no files under 'output_uri_prefix'.
+   * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+   * INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * string output_uri_prefix = 1; + */ + java.lang.String getOutputUriPrefix(); + /** + * + * + *
+   * Required. There must be no files under 'output_uri_prefix'.
+   * 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an
+   * INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * string output_uri_prefix = 1; + */ + com.google.protobuf.ByteString getOutputUriPrefixBytes(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsSource.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsSource.java new file mode 100644 index 00000000..503c23b1 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsSource.java @@ -0,0 +1,610 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The Google Cloud Storage location for the input content.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GcsSource} + */ +public final class GcsSource extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.GcsSource) + GcsSourceOrBuilder { + private static final long serialVersionUID = 0L; + // Use GcsSource.newBuilder() to construct. + private GcsSource(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GcsSource() { + inputUri_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GcsSource( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + inputUri_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GcsSource.class, + com.google.cloud.translate.v3.GcsSource.Builder.class); + } + + public static final int INPUT_URI_FIELD_NUMBER = 1; + private volatile java.lang.Object inputUri_; + /** + * + * + *
+   * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+   * 
+ * + * string input_uri = 1; + */ + public java.lang.String getInputUri() { + java.lang.Object ref = inputUri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + inputUri_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+   * 
+ * + * string input_uri = 1; + */ + public com.google.protobuf.ByteString getInputUriBytes() { + java.lang.Object ref = inputUri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + inputUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getInputUriBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, inputUri_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getInputUriBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, inputUri_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.GcsSource)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.GcsSource other = (com.google.cloud.translate.v3.GcsSource) obj; + + if (!getInputUri().equals(other.getInputUri())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + INPUT_URI_FIELD_NUMBER; + hash = (53 * hash) + getInputUri().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsSource parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GcsSource parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GcsSource parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.GcsSource prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The Google Cloud Storage location for the input content.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GcsSource} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.GcsSource) + com.google.cloud.translate.v3.GcsSourceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsSource_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsSource_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GcsSource.class, + com.google.cloud.translate.v3.GcsSource.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.GcsSource.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + inputUri_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GcsSource_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GcsSource getDefaultInstanceForType() { + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.GcsSource build() { + com.google.cloud.translate.v3.GcsSource result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GcsSource buildPartial() { + com.google.cloud.translate.v3.GcsSource result = + new com.google.cloud.translate.v3.GcsSource(this); + result.inputUri_ = inputUri_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.GcsSource) { + return mergeFrom((com.google.cloud.translate.v3.GcsSource) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.GcsSource other) { + if (other == com.google.cloud.translate.v3.GcsSource.getDefaultInstance()) return this; + if (!other.getInputUri().isEmpty()) { + inputUri_ = other.inputUri_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.GcsSource parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.GcsSource) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object inputUri_ = ""; + /** + * + * + *
+     * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+     * 
+ * + * string input_uri = 1; + */ + public java.lang.String getInputUri() { + java.lang.Object ref = inputUri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + inputUri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+     * 
+ * + * string input_uri = 1; + */ + public com.google.protobuf.ByteString getInputUriBytes() { + java.lang.Object ref = inputUri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + inputUri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+     * 
+ * + * string input_uri = 1; + */ + public Builder setInputUri(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + inputUri_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+     * 
+ * + * string input_uri = 1; + */ + public Builder clearInputUri() { + + inputUri_ = getDefaultInstance().getInputUri(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+     * 
+ * + * string input_uri = 1; + */ + public Builder setInputUriBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + inputUri_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.GcsSource) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GcsSource) + private static final com.google.cloud.translate.v3.GcsSource DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.GcsSource(); + } + + public static com.google.cloud.translate.v3.GcsSource getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GcsSource parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GcsSource(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GcsSource getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsSourceOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsSourceOrBuilder.java new file mode 100644 index 00000000..d9791df5 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GcsSourceOrBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface GcsSourceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.GcsSource) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+   * 
+ * + * string input_uri = 1; + */ + java.lang.String getInputUri(); + /** + * + * + *
+   * Required. Source data URI. For example, `gs://my_bucket/my_object`.
+   * 
+ * + * string input_uri = 1; + */ + com.google.protobuf.ByteString getInputUriBytes(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetGlossaryRequest.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetGlossaryRequest.java new file mode 100644 index 00000000..a3a6ac62 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetGlossaryRequest.java @@ -0,0 +1,626 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Request message for GetGlossary.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GetGlossaryRequest} + */ +public final class GetGlossaryRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.GetGlossaryRequest) + GetGlossaryRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetGlossaryRequest.newBuilder() to construct. + private GetGlossaryRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetGlossaryRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetGlossaryRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetGlossaryRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetGlossaryRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GetGlossaryRequest.class, + com.google.cloud.translate.v3.GetGlossaryRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the glossary to retrieve.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the glossary to retrieve.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.GetGlossaryRequest)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.GetGlossaryRequest other = + (com.google.cloud.translate.v3.GetGlossaryRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.GetGlossaryRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for GetGlossary.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GetGlossaryRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.GetGlossaryRequest) + com.google.cloud.translate.v3.GetGlossaryRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetGlossaryRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetGlossaryRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GetGlossaryRequest.class, + com.google.cloud.translate.v3.GetGlossaryRequest.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.GetGlossaryRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetGlossaryRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GetGlossaryRequest getDefaultInstanceForType() { + return com.google.cloud.translate.v3.GetGlossaryRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.GetGlossaryRequest build() { + com.google.cloud.translate.v3.GetGlossaryRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GetGlossaryRequest buildPartial() { + com.google.cloud.translate.v3.GetGlossaryRequest result = + new com.google.cloud.translate.v3.GetGlossaryRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.GetGlossaryRequest) { + return mergeFrom((com.google.cloud.translate.v3.GetGlossaryRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.GetGlossaryRequest other) { + if (other == com.google.cloud.translate.v3.GetGlossaryRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.GetGlossaryRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.GetGlossaryRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the glossary to retrieve.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the glossary to retrieve.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the glossary to retrieve.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the glossary to retrieve.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the glossary to retrieve.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.GetGlossaryRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GetGlossaryRequest) + private static final com.google.cloud.translate.v3.GetGlossaryRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.GetGlossaryRequest(); + } + + public static com.google.cloud.translate.v3.GetGlossaryRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetGlossaryRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetGlossaryRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GetGlossaryRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetGlossaryRequestOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetGlossaryRequestOrBuilder.java new file mode 100644 index 00000000..af79bb5b --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetGlossaryRequestOrBuilder.java @@ -0,0 +1,50 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface GetGlossaryRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.GetGlossaryRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the glossary to retrieve.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the glossary to retrieve.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetSupportedLanguagesRequest.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetSupportedLanguagesRequest.java new file mode 100644 index 00000000..80678748 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetSupportedLanguagesRequest.java @@ -0,0 +1,1076 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The request message for discovering supported languages.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GetSupportedLanguagesRequest} + */ +public final class GetSupportedLanguagesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.GetSupportedLanguagesRequest) + GetSupportedLanguagesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetSupportedLanguagesRequest.newBuilder() to construct. + private GetSupportedLanguagesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetSupportedLanguagesRequest() { + parent_ = ""; + displayLanguageCode_ = ""; + model_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetSupportedLanguagesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayLanguageCode_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + model_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GetSupportedLanguagesRequest.class, + com.google.cloud.translate.v3.GetSupportedLanguagesRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 3; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}` or
+   * `projects/{project-number-or-id}/locations/{location-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Non-global location is required for AutoML models.
+   * Only models within the same region (have same location-id) can be used,
+   * otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}` or
+   * `projects/{project-number-or-id}/locations/{location-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Non-global location is required for AutoML models.
+   * Only models within the same region (have same location-id) can be used,
+   * otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_LANGUAGE_CODE_FIELD_NUMBER = 1; + private volatile java.lang.Object displayLanguageCode_; + /** + * + * + *
+   * Optional. The language to use to return localized, human readable names
+   * of supported languages. If missing, then display names are not returned
+   * in a response.
+   * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getDisplayLanguageCode() { + java.lang.Object ref = displayLanguageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayLanguageCode_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The language to use to return localized, human readable names
+   * of supported languages. If missing, then display names are not returned
+   * in a response.
+   * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getDisplayLanguageCodeBytes() { + java.lang.Object ref = displayLanguageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MODEL_FIELD_NUMBER = 2; + private volatile java.lang.Object model_; + /** + * + * + *
+   * Optional. Get supported languages of this model.
+   * The format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * Returns languages supported by the specified model.
+   * If missing, we get supported languages of Google general base (PBMT) model.
+   * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Get supported languages of this model.
+   * The format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * Returns languages supported by the specified model.
+   * If missing, we get supported languages of Google general base (PBMT) model.
+   * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getDisplayLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, displayLanguageCode_); + } + if (!getModelBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, model_); + } + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, parent_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getDisplayLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, displayLanguageCode_); + } + if (!getModelBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, model_); + } + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, parent_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.GetSupportedLanguagesRequest)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.GetSupportedLanguagesRequest other = + (com.google.cloud.translate.v3.GetSupportedLanguagesRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getDisplayLanguageCode().equals(other.getDisplayLanguageCode())) return false; + if (!getModel().equals(other.getModel())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + DISPLAY_LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getDisplayLanguageCode().hashCode(); + hash = (37 * hash) + MODEL_FIELD_NUMBER; + hash = (53 * hash) + getModel().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.translate.v3.GetSupportedLanguagesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request message for discovering supported languages.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GetSupportedLanguagesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.GetSupportedLanguagesRequest) + com.google.cloud.translate.v3.GetSupportedLanguagesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GetSupportedLanguagesRequest.class, + com.google.cloud.translate.v3.GetSupportedLanguagesRequest.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.GetSupportedLanguagesRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + displayLanguageCode_ = ""; + + model_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GetSupportedLanguagesRequest getDefaultInstanceForType() { + return com.google.cloud.translate.v3.GetSupportedLanguagesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.GetSupportedLanguagesRequest build() { + com.google.cloud.translate.v3.GetSupportedLanguagesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GetSupportedLanguagesRequest buildPartial() { + com.google.cloud.translate.v3.GetSupportedLanguagesRequest result = + new com.google.cloud.translate.v3.GetSupportedLanguagesRequest(this); + result.parent_ = parent_; + result.displayLanguageCode_ = displayLanguageCode_; + result.model_ = model_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.GetSupportedLanguagesRequest) { + return mergeFrom((com.google.cloud.translate.v3.GetSupportedLanguagesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.GetSupportedLanguagesRequest other) { + if (other == com.google.cloud.translate.v3.GetSupportedLanguagesRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getDisplayLanguageCode().isEmpty()) { + displayLanguageCode_ = other.displayLanguageCode_; + onChanged(); + } + if (!other.getModel().isEmpty()) { + model_ = other.model_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.GetSupportedLanguagesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.GetSupportedLanguagesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for AutoML models.
+     * Only models within the same region (have same location-id) can be used,
+     * otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for AutoML models.
+     * Only models within the same region (have same location-id) can be used,
+     * otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for AutoML models.
+     * Only models within the same region (have same location-id) can be used,
+     * otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for AutoML models.
+     * Only models within the same region (have same location-id) can be used,
+     * otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for AutoML models.
+     * Only models within the same region (have same location-id) can be used,
+     * otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayLanguageCode_ = ""; + /** + * + * + *
+     * Optional. The language to use to return localized, human readable names
+     * of supported languages. If missing, then display names are not returned
+     * in a response.
+     * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getDisplayLanguageCode() { + java.lang.Object ref = displayLanguageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayLanguageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The language to use to return localized, human readable names
+     * of supported languages. If missing, then display names are not returned
+     * in a response.
+     * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getDisplayLanguageCodeBytes() { + java.lang.Object ref = displayLanguageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The language to use to return localized, human readable names
+     * of supported languages. If missing, then display names are not returned
+     * in a response.
+     * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setDisplayLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayLanguageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The language to use to return localized, human readable names
+     * of supported languages. If missing, then display names are not returned
+     * in a response.
+     * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearDisplayLanguageCode() { + + displayLanguageCode_ = getDefaultInstance().getDisplayLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The language to use to return localized, human readable names
+     * of supported languages. If missing, then display names are not returned
+     * in a response.
+     * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setDisplayLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayLanguageCode_ = value; + onChanged(); + return this; + } + + private java.lang.Object model_ = ""; + /** + * + * + *
+     * Optional. Get supported languages of this model.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * Returns languages supported by the specified model.
+     * If missing, we get supported languages of Google general base (PBMT) model.
+     * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Get supported languages of this model.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * Returns languages supported by the specified model.
+     * If missing, we get supported languages of Google general base (PBMT) model.
+     * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Get supported languages of this model.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * Returns languages supported by the specified model.
+     * If missing, we get supported languages of Google general base (PBMT) model.
+     * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setModel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + model_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Get supported languages of this model.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * Returns languages supported by the specified model.
+     * If missing, we get supported languages of Google general base (PBMT) model.
+     * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearModel() { + + model_ = getDefaultInstance().getModel(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Get supported languages of this model.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * Returns languages supported by the specified model.
+     * If missing, we get supported languages of Google general base (PBMT) model.
+     * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setModelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + model_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.GetSupportedLanguagesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GetSupportedLanguagesRequest) + private static final com.google.cloud.translate.v3.GetSupportedLanguagesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.GetSupportedLanguagesRequest(); + } + + public static com.google.cloud.translate.v3.GetSupportedLanguagesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetSupportedLanguagesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetSupportedLanguagesRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GetSupportedLanguagesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetSupportedLanguagesRequestOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetSupportedLanguagesRequestOrBuilder.java new file mode 100644 index 00000000..ed2928e4 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GetSupportedLanguagesRequestOrBuilder.java @@ -0,0 +1,128 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface GetSupportedLanguagesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.GetSupportedLanguagesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}` or
+   * `projects/{project-number-or-id}/locations/{location-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Non-global location is required for AutoML models.
+   * Only models within the same region (have same location-id) can be used,
+   * otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}` or
+   * `projects/{project-number-or-id}/locations/{location-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Non-global location is required for AutoML models.
+   * Only models within the same region (have same location-id) can be used,
+   * otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. The language to use to return localized, human readable names
+   * of supported languages. If missing, then display names are not returned
+   * in a response.
+   * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getDisplayLanguageCode(); + /** + * + * + *
+   * Optional. The language to use to return localized, human readable names
+   * of supported languages. If missing, then display names are not returned
+   * in a response.
+   * 
+ * + * string display_language_code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getDisplayLanguageCodeBytes(); + + /** + * + * + *
+   * Optional. Get supported languages of this model.
+   * The format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * Returns languages supported by the specified model.
+   * If missing, we get supported languages of Google general base (PBMT) model.
+   * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getModel(); + /** + * + * + *
+   * Optional. Get supported languages of this model.
+   * The format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * Returns languages supported by the specified model.
+   * If missing, we get supported languages of Google general base (PBMT) model.
+   * 
+ * + * string model = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getModelBytes(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/Glossary.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/Glossary.java new file mode 100644 index 00000000..9eb46ba0 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/Glossary.java @@ -0,0 +1,3785 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Represents a glossary built from user provided data.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.Glossary} + */ +public final class Glossary extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.Glossary) + GlossaryOrBuilder { + private static final long serialVersionUID = 0L; + // Use Glossary.newBuilder() to construct. + private Glossary(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Glossary() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Glossary( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 26: + { + com.google.cloud.translate.v3.Glossary.LanguageCodePair.Builder subBuilder = null; + if (languagesCase_ == 3) { + subBuilder = + ((com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_) + .toBuilder(); + } + languages_ = + input.readMessage( + com.google.cloud.translate.v3.Glossary.LanguageCodePair.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_); + languages_ = subBuilder.buildPartial(); + } + languagesCase_ = 3; + break; + } + case 34: + { + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.Builder subBuilder = null; + if (languagesCase_ == 4) { + subBuilder = + ((com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_) + .toBuilder(); + } + languages_ = + input.readMessage( + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_); + languages_ = subBuilder.buildPartial(); + } + languagesCase_ = 4; + break; + } + case 42: + { + com.google.cloud.translate.v3.GlossaryInputConfig.Builder subBuilder = null; + if (inputConfig_ != null) { + subBuilder = inputConfig_.toBuilder(); + } + inputConfig_ = + input.readMessage( + com.google.cloud.translate.v3.GlossaryInputConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(inputConfig_); + inputConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 48: + { + entryCount_ = input.readInt32(); + break; + } + case 58: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (submitTime_ != null) { + subBuilder = submitTime_.toBuilder(); + } + submitTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(submitTime_); + submitTime_ = subBuilder.buildPartial(); + } + + break; + } + case 66: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (endTime_ != null) { + subBuilder = endTime_.toBuilder(); + } + endTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(endTime_); + endTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.Glossary.class, + com.google.cloud.translate.v3.Glossary.Builder.class); + } + + public interface LanguageCodePairOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.Glossary.LanguageCodePair) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Required. The BCP-47 language code of the input text, for example,
+     * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * string source_language_code = 1; + */ + java.lang.String getSourceLanguageCode(); + /** + * + * + *
+     * Required. The BCP-47 language code of the input text, for example,
+     * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * string source_language_code = 1; + */ + com.google.protobuf.ByteString getSourceLanguageCodeBytes(); + + /** + * + * + *
+     * Required. The BCP-47 language code for translation output, for example,
+     * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * string target_language_code = 2; + */ + java.lang.String getTargetLanguageCode(); + /** + * + * + *
+     * Required. The BCP-47 language code for translation output, for example,
+     * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * string target_language_code = 2; + */ + com.google.protobuf.ByteString getTargetLanguageCodeBytes(); + } + /** + * + * + *
+   * Used with unidirectional glossaries.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.Glossary.LanguageCodePair} + */ + public static final class LanguageCodePair extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.Glossary.LanguageCodePair) + LanguageCodePairOrBuilder { + private static final long serialVersionUID = 0L; + // Use LanguageCodePair.newBuilder() to construct. + private LanguageCodePair(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private LanguageCodePair() { + sourceLanguageCode_ = ""; + targetLanguageCode_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private LanguageCodePair( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + sourceLanguageCode_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + targetLanguageCode_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.Glossary.LanguageCodePair.class, + com.google.cloud.translate.v3.Glossary.LanguageCodePair.Builder.class); + } + + public static final int SOURCE_LANGUAGE_CODE_FIELD_NUMBER = 1; + private volatile java.lang.Object sourceLanguageCode_; + /** + * + * + *
+     * Required. The BCP-47 language code of the input text, for example,
+     * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * string source_language_code = 1; + */ + public java.lang.String getSourceLanguageCode() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceLanguageCode_ = s; + return s; + } + } + /** + * + * + *
+     * Required. The BCP-47 language code of the input text, for example,
+     * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * string source_language_code = 1; + */ + public com.google.protobuf.ByteString getSourceLanguageCodeBytes() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sourceLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TARGET_LANGUAGE_CODE_FIELD_NUMBER = 2; + private volatile java.lang.Object targetLanguageCode_; + /** + * + * + *
+     * Required. The BCP-47 language code for translation output, for example,
+     * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * string target_language_code = 2; + */ + public java.lang.String getTargetLanguageCode() { + java.lang.Object ref = targetLanguageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + targetLanguageCode_ = s; + return s; + } + } + /** + * + * + *
+     * Required. The BCP-47 language code for translation output, for example,
+     * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * string target_language_code = 2; + */ + public com.google.protobuf.ByteString getTargetLanguageCodeBytes() { + java.lang.Object ref = targetLanguageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + targetLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getSourceLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sourceLanguageCode_); + } + if (!getTargetLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, targetLanguageCode_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getSourceLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sourceLanguageCode_); + } + if (!getTargetLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, targetLanguageCode_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.Glossary.LanguageCodePair)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.Glossary.LanguageCodePair other = + (com.google.cloud.translate.v3.Glossary.LanguageCodePair) obj; + + if (!getSourceLanguageCode().equals(other.getSourceLanguageCode())) return false; + if (!getTargetLanguageCode().equals(other.getTargetLanguageCode())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SOURCE_LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getSourceLanguageCode().hashCode(); + hash = (37 * hash) + TARGET_LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getTargetLanguageCode().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.translate.v3.Glossary.LanguageCodePair prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * Protobuf type {@code google.cloud.translation.v3.Glossary.LanguageCodePair} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.Glossary.LanguageCodePair) + com.google.cloud.translate.v3.Glossary.LanguageCodePairOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.Glossary.LanguageCodePair.class, + com.google.cloud.translate.v3.Glossary.LanguageCodePair.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.Glossary.LanguageCodePair.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + sourceLanguageCode_ = ""; + + targetLanguageCode_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary.LanguageCodePair getDefaultInstanceForType() { + return com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary.LanguageCodePair build() { + com.google.cloud.translate.v3.Glossary.LanguageCodePair result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary.LanguageCodePair buildPartial() { + com.google.cloud.translate.v3.Glossary.LanguageCodePair result = + new com.google.cloud.translate.v3.Glossary.LanguageCodePair(this); + result.sourceLanguageCode_ = sourceLanguageCode_; + result.targetLanguageCode_ = targetLanguageCode_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.Glossary.LanguageCodePair) { + return mergeFrom((com.google.cloud.translate.v3.Glossary.LanguageCodePair) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.Glossary.LanguageCodePair other) { + if (other == com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance()) + return this; + if (!other.getSourceLanguageCode().isEmpty()) { + sourceLanguageCode_ = other.sourceLanguageCode_; + onChanged(); + } + if (!other.getTargetLanguageCode().isEmpty()) { + targetLanguageCode_ = other.targetLanguageCode_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.Glossary.LanguageCodePair parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.Glossary.LanguageCodePair) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object sourceLanguageCode_ = ""; + /** + * + * + *
+       * Required. The BCP-47 language code of the input text, for example,
+       * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string source_language_code = 1; + */ + public java.lang.String getSourceLanguageCode() { + java.lang.Object ref = sourceLanguageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceLanguageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Required. The BCP-47 language code of the input text, for example,
+       * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string source_language_code = 1; + */ + public com.google.protobuf.ByteString getSourceLanguageCodeBytes() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sourceLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Required. The BCP-47 language code of the input text, for example,
+       * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string source_language_code = 1; + */ + public Builder setSourceLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sourceLanguageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Required. The BCP-47 language code of the input text, for example,
+       * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string source_language_code = 1; + */ + public Builder clearSourceLanguageCode() { + + sourceLanguageCode_ = getDefaultInstance().getSourceLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+       * Required. The BCP-47 language code of the input text, for example,
+       * "en-US". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string source_language_code = 1; + */ + public Builder setSourceLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sourceLanguageCode_ = value; + onChanged(); + return this; + } + + private java.lang.Object targetLanguageCode_ = ""; + /** + * + * + *
+       * Required. The BCP-47 language code for translation output, for example,
+       * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string target_language_code = 2; + */ + public java.lang.String getTargetLanguageCode() { + java.lang.Object ref = targetLanguageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + targetLanguageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Required. The BCP-47 language code for translation output, for example,
+       * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string target_language_code = 2; + */ + public com.google.protobuf.ByteString getTargetLanguageCodeBytes() { + java.lang.Object ref = targetLanguageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + targetLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Required. The BCP-47 language code for translation output, for example,
+       * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string target_language_code = 2; + */ + public Builder setTargetLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + targetLanguageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Required. The BCP-47 language code for translation output, for example,
+       * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string target_language_code = 2; + */ + public Builder clearTargetLanguageCode() { + + targetLanguageCode_ = getDefaultInstance().getTargetLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+       * Required. The BCP-47 language code for translation output, for example,
+       * "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * string target_language_code = 2; + */ + public Builder setTargetLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + targetLanguageCode_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.Glossary.LanguageCodePair) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.Glossary.LanguageCodePair) + private static final com.google.cloud.translate.v3.Glossary.LanguageCodePair DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.Glossary.LanguageCodePair(); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodePair getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LanguageCodePair parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LanguageCodePair(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary.LanguageCodePair getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface LanguageCodesSetOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.Glossary.LanguageCodesSet) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The BCP-47 language code(s) for terms defined in the glossary.
+     * All entries are unique. The list contains at least two entries.
+     * Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * repeated string language_codes = 1; + */ + java.util.List getLanguageCodesList(); + /** + * + * + *
+     * The BCP-47 language code(s) for terms defined in the glossary.
+     * All entries are unique. The list contains at least two entries.
+     * Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * repeated string language_codes = 1; + */ + int getLanguageCodesCount(); + /** + * + * + *
+     * The BCP-47 language code(s) for terms defined in the glossary.
+     * All entries are unique. The list contains at least two entries.
+     * Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * repeated string language_codes = 1; + */ + java.lang.String getLanguageCodes(int index); + /** + * + * + *
+     * The BCP-47 language code(s) for terms defined in the glossary.
+     * All entries are unique. The list contains at least two entries.
+     * Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * repeated string language_codes = 1; + */ + com.google.protobuf.ByteString getLanguageCodesBytes(int index); + } + /** + * + * + *
+   * Used with equivalent term set glossaries.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.Glossary.LanguageCodesSet} + */ + public static final class LanguageCodesSet extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.Glossary.LanguageCodesSet) + LanguageCodesSetOrBuilder { + private static final long serialVersionUID = 0L; + // Use LanguageCodesSet.newBuilder() to construct. + private LanguageCodesSet(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private LanguageCodesSet() { + languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private LanguageCodesSet( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + languageCodes_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + languageCodes_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + languageCodes_ = languageCodes_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.class, + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.Builder.class); + } + + public static final int LANGUAGE_CODES_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList languageCodes_; + /** + * + * + *
+     * The BCP-47 language code(s) for terms defined in the glossary.
+     * All entries are unique. The list contains at least two entries.
+     * Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * repeated string language_codes = 1; + */ + public com.google.protobuf.ProtocolStringList getLanguageCodesList() { + return languageCodes_; + } + /** + * + * + *
+     * The BCP-47 language code(s) for terms defined in the glossary.
+     * All entries are unique. The list contains at least two entries.
+     * Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * repeated string language_codes = 1; + */ + public int getLanguageCodesCount() { + return languageCodes_.size(); + } + /** + * + * + *
+     * The BCP-47 language code(s) for terms defined in the glossary.
+     * All entries are unique. The list contains at least two entries.
+     * Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * repeated string language_codes = 1; + */ + public java.lang.String getLanguageCodes(int index) { + return languageCodes_.get(index); + } + /** + * + * + *
+     * The BCP-47 language code(s) for terms defined in the glossary.
+     * All entries are unique. The list contains at least two entries.
+     * Expected to be an exact match for GlossaryTerm.language_code.
+     * 
+ * + * repeated string language_codes = 1; + */ + public com.google.protobuf.ByteString getLanguageCodesBytes(int index) { + return languageCodes_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < languageCodes_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, languageCodes_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < languageCodes_.size(); i++) { + dataSize += computeStringSizeNoTag(languageCodes_.getRaw(i)); + } + size += dataSize; + size += 1 * getLanguageCodesList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.Glossary.LanguageCodesSet)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.Glossary.LanguageCodesSet other = + (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) obj; + + if (!getLanguageCodesList().equals(other.getLanguageCodesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getLanguageCodesCount() > 0) { + hash = (37 * hash) + LANGUAGE_CODES_FIELD_NUMBER; + hash = (53 * hash) + getLanguageCodesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.translate.v3.Glossary.LanguageCodesSet prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * Protobuf type {@code google.cloud.translation.v3.Glossary.LanguageCodesSet} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.Glossary.LanguageCodesSet) + com.google.cloud.translate.v3.Glossary.LanguageCodesSetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.class, + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.Glossary.LanguageCodesSet.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary.LanguageCodesSet getDefaultInstanceForType() { + return com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary.LanguageCodesSet build() { + com.google.cloud.translate.v3.Glossary.LanguageCodesSet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary.LanguageCodesSet buildPartial() { + com.google.cloud.translate.v3.Glossary.LanguageCodesSet result = + new com.google.cloud.translate.v3.Glossary.LanguageCodesSet(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + languageCodes_ = languageCodes_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.languageCodes_ = languageCodes_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.Glossary.LanguageCodesSet) { + return mergeFrom((com.google.cloud.translate.v3.Glossary.LanguageCodesSet) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.Glossary.LanguageCodesSet other) { + if (other == com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance()) + return this; + if (!other.languageCodes_.isEmpty()) { + if (languageCodes_.isEmpty()) { + languageCodes_ = other.languageCodes_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLanguageCodesIsMutable(); + languageCodes_.addAll(other.languageCodes_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.Glossary.LanguageCodesSet parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList languageCodes_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureLanguageCodesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + languageCodes_ = new com.google.protobuf.LazyStringArrayList(languageCodes_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public com.google.protobuf.ProtocolStringList getLanguageCodesList() { + return languageCodes_.getUnmodifiableView(); + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public int getLanguageCodesCount() { + return languageCodes_.size(); + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public java.lang.String getLanguageCodes(int index) { + return languageCodes_.get(index); + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public com.google.protobuf.ByteString getLanguageCodesBytes(int index) { + return languageCodes_.getByteString(index); + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public Builder setLanguageCodes(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguageCodesIsMutable(); + languageCodes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public Builder addLanguageCodes(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguageCodesIsMutable(); + languageCodes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public Builder addAllLanguageCodes(java.lang.Iterable values) { + ensureLanguageCodesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, languageCodes_); + onChanged(); + return this; + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public Builder clearLanguageCodes() { + languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * The BCP-47 language code(s) for terms defined in the glossary.
+       * All entries are unique. The list contains at least two entries.
+       * Expected to be an exact match for GlossaryTerm.language_code.
+       * 
+ * + * repeated string language_codes = 1; + */ + public Builder addLanguageCodesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureLanguageCodesIsMutable(); + languageCodes_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.Glossary.LanguageCodesSet) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.Glossary.LanguageCodesSet) + private static final com.google.cloud.translate.v3.Glossary.LanguageCodesSet DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.Glossary.LanguageCodesSet(); + } + + public static com.google.cloud.translate.v3.Glossary.LanguageCodesSet getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LanguageCodesSet parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LanguageCodesSet(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary.LanguageCodesSet getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int languagesCase_ = 0; + private java.lang.Object languages_; + + public enum LanguagesCase implements com.google.protobuf.Internal.EnumLite { + LANGUAGE_PAIR(3), + LANGUAGE_CODES_SET(4), + LANGUAGES_NOT_SET(0); + private final int value; + + private LanguagesCase(int value) { + this.value = value; + } + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static LanguagesCase valueOf(int value) { + return forNumber(value); + } + + public static LanguagesCase forNumber(int value) { + switch (value) { + case 3: + return LANGUAGE_PAIR; + case 4: + return LANGUAGE_CODES_SET; + case 0: + return LANGUAGES_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public LanguagesCase getLanguagesCase() { + return LanguagesCase.forNumber(languagesCase_); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the glossary. Glossary names have the form
+   * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+   * 
+ * + * string name = 1; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the glossary. Glossary names have the form
+   * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+   * 
+ * + * string name = 1; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LANGUAGE_PAIR_FIELD_NUMBER = 3; + /** + * + * + *
+   * Used with unidirectional glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public boolean hasLanguagePair() { + return languagesCase_ == 3; + } + /** + * + * + *
+   * Used with unidirectional glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodePair getLanguagePair() { + if (languagesCase_ == 3) { + return (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_; + } + return com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance(); + } + /** + * + * + *
+   * Used with unidirectional glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodePairOrBuilder + getLanguagePairOrBuilder() { + if (languagesCase_ == 3) { + return (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_; + } + return com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance(); + } + + public static final int LANGUAGE_CODES_SET_FIELD_NUMBER = 4; + /** + * + * + *
+   * Used with equivalent term set glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public boolean hasLanguageCodesSet() { + return languagesCase_ == 4; + } + /** + * + * + *
+   * Used with equivalent term set glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodesSet getLanguageCodesSet() { + if (languagesCase_ == 4) { + return (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_; + } + return com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance(); + } + /** + * + * + *
+   * Used with equivalent term set glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodesSetOrBuilder + getLanguageCodesSetOrBuilder() { + if (languagesCase_ == 4) { + return (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_; + } + return com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance(); + } + + public static final int INPUT_CONFIG_FIELD_NUMBER = 5; + private com.google.cloud.translate.v3.GlossaryInputConfig inputConfig_; + /** + * + * + *
+   * Required. Provides examples to build the glossary from.
+   * Total glossary must not exceed 10M Unicode codepoints.
+   * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public boolean hasInputConfig() { + return inputConfig_ != null; + } + /** + * + * + *
+   * Required. Provides examples to build the glossary from.
+   * Total glossary must not exceed 10M Unicode codepoints.
+   * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public com.google.cloud.translate.v3.GlossaryInputConfig getInputConfig() { + return inputConfig_ == null + ? com.google.cloud.translate.v3.GlossaryInputConfig.getDefaultInstance() + : inputConfig_; + } + /** + * + * + *
+   * Required. Provides examples to build the glossary from.
+   * Total glossary must not exceed 10M Unicode codepoints.
+   * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public com.google.cloud.translate.v3.GlossaryInputConfigOrBuilder getInputConfigOrBuilder() { + return getInputConfig(); + } + + public static final int ENTRY_COUNT_FIELD_NUMBER = 6; + private int entryCount_; + /** + * + * + *
+   * Output only. The number of entries defined in the glossary.
+   * 
+ * + * int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public int getEntryCount() { + return entryCount_; + } + + public static final int SUBMIT_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp submitTime_; + /** + * + * + *
+   * Output only. When CreateGlossary was called.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public boolean hasSubmitTime() { + return submitTime_ != null; + } + /** + * + * + *
+   * Output only. When CreateGlossary was called.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp getSubmitTime() { + return submitTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : submitTime_; + } + /** + * + * + *
+   * Output only. When CreateGlossary was called.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + return getSubmitTime(); + } + + public static final int END_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+   * Output only. When the glossary creation was finished.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public boolean hasEndTime() { + return endTime_ != null; + } + /** + * + * + *
+   * Output only. When the glossary creation was finished.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+   * Output only. When the glossary creation was finished.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return getEndTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (languagesCase_ == 3) { + output.writeMessage(3, (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_); + } + if (languagesCase_ == 4) { + output.writeMessage(4, (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_); + } + if (inputConfig_ != null) { + output.writeMessage(5, getInputConfig()); + } + if (entryCount_ != 0) { + output.writeInt32(6, entryCount_); + } + if (submitTime_ != null) { + output.writeMessage(7, getSubmitTime()); + } + if (endTime_ != null) { + output.writeMessage(8, getEndTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (languagesCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_); + } + if (languagesCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_); + } + if (inputConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getInputConfig()); + } + if (entryCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(6, entryCount_); + } + if (submitTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getSubmitTime()); + } + if (endTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getEndTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.Glossary)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.Glossary other = (com.google.cloud.translate.v3.Glossary) obj; + + if (!getName().equals(other.getName())) return false; + if (hasInputConfig() != other.hasInputConfig()) return false; + if (hasInputConfig()) { + if (!getInputConfig().equals(other.getInputConfig())) return false; + } + if (getEntryCount() != other.getEntryCount()) return false; + if (hasSubmitTime() != other.hasSubmitTime()) return false; + if (hasSubmitTime()) { + if (!getSubmitTime().equals(other.getSubmitTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (!getLanguagesCase().equals(other.getLanguagesCase())) return false; + switch (languagesCase_) { + case 3: + if (!getLanguagePair().equals(other.getLanguagePair())) return false; + break; + case 4: + if (!getLanguageCodesSet().equals(other.getLanguageCodesSet())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasInputConfig()) { + hash = (37 * hash) + INPUT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getInputConfig().hashCode(); + } + hash = (37 * hash) + ENTRY_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getEntryCount(); + if (hasSubmitTime()) { + hash = (37 * hash) + SUBMIT_TIME_FIELD_NUMBER; + hash = (53 * hash) + getSubmitTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + switch (languagesCase_) { + case 3: + hash = (37 * hash) + LANGUAGE_PAIR_FIELD_NUMBER; + hash = (53 * hash) + getLanguagePair().hashCode(); + break; + case 4: + hash = (37 * hash) + LANGUAGE_CODES_SET_FIELD_NUMBER; + hash = (53 * hash) + getLanguageCodesSet().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.Glossary parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Glossary parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.Glossary prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents a glossary built from user provided data.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.Glossary} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.Glossary) + com.google.cloud.translate.v3.GlossaryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.Glossary.class, + com.google.cloud.translate.v3.Glossary.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.Glossary.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + if (inputConfigBuilder_ == null) { + inputConfig_ = null; + } else { + inputConfig_ = null; + inputConfigBuilder_ = null; + } + entryCount_ = 0; + + if (submitTimeBuilder_ == null) { + submitTime_ = null; + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + if (endTimeBuilder_ == null) { + endTime_ = null; + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + languagesCase_ = 0; + languages_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Glossary_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary getDefaultInstanceForType() { + return com.google.cloud.translate.v3.Glossary.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary build() { + com.google.cloud.translate.v3.Glossary result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary buildPartial() { + com.google.cloud.translate.v3.Glossary result = + new com.google.cloud.translate.v3.Glossary(this); + result.name_ = name_; + if (languagesCase_ == 3) { + if (languagePairBuilder_ == null) { + result.languages_ = languages_; + } else { + result.languages_ = languagePairBuilder_.build(); + } + } + if (languagesCase_ == 4) { + if (languageCodesSetBuilder_ == null) { + result.languages_ = languages_; + } else { + result.languages_ = languageCodesSetBuilder_.build(); + } + } + if (inputConfigBuilder_ == null) { + result.inputConfig_ = inputConfig_; + } else { + result.inputConfig_ = inputConfigBuilder_.build(); + } + result.entryCount_ = entryCount_; + if (submitTimeBuilder_ == null) { + result.submitTime_ = submitTime_; + } else { + result.submitTime_ = submitTimeBuilder_.build(); + } + if (endTimeBuilder_ == null) { + result.endTime_ = endTime_; + } else { + result.endTime_ = endTimeBuilder_.build(); + } + result.languagesCase_ = languagesCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.Glossary) { + return mergeFrom((com.google.cloud.translate.v3.Glossary) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.Glossary other) { + if (other == com.google.cloud.translate.v3.Glossary.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasInputConfig()) { + mergeInputConfig(other.getInputConfig()); + } + if (other.getEntryCount() != 0) { + setEntryCount(other.getEntryCount()); + } + if (other.hasSubmitTime()) { + mergeSubmitTime(other.getSubmitTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + switch (other.getLanguagesCase()) { + case LANGUAGE_PAIR: + { + mergeLanguagePair(other.getLanguagePair()); + break; + } + case LANGUAGE_CODES_SET: + { + mergeLanguageCodesSet(other.getLanguageCodesSet()); + break; + } + case LANGUAGES_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.Glossary parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.Glossary) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int languagesCase_ = 0; + private java.lang.Object languages_; + + public LanguagesCase getLanguagesCase() { + return LanguagesCase.forNumber(languagesCase_); + } + + public Builder clearLanguages() { + languagesCase_ = 0; + languages_ = null; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the glossary. Glossary names have the form
+     * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+     * 
+ * + * string name = 1; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the glossary. Glossary names have the form
+     * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+     * 
+ * + * string name = 1; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the glossary. Glossary names have the form
+     * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+     * 
+ * + * string name = 1; + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the glossary. Glossary names have the form
+     * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the glossary. Glossary names have the form
+     * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary.LanguageCodePair, + com.google.cloud.translate.v3.Glossary.LanguageCodePair.Builder, + com.google.cloud.translate.v3.Glossary.LanguageCodePairOrBuilder> + languagePairBuilder_; + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public boolean hasLanguagePair() { + return languagesCase_ == 3; + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodePair getLanguagePair() { + if (languagePairBuilder_ == null) { + if (languagesCase_ == 3) { + return (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_; + } + return com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance(); + } else { + if (languagesCase_ == 3) { + return languagePairBuilder_.getMessage(); + } + return com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance(); + } + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public Builder setLanguagePair(com.google.cloud.translate.v3.Glossary.LanguageCodePair value) { + if (languagePairBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + languages_ = value; + onChanged(); + } else { + languagePairBuilder_.setMessage(value); + } + languagesCase_ = 3; + return this; + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public Builder setLanguagePair( + com.google.cloud.translate.v3.Glossary.LanguageCodePair.Builder builderForValue) { + if (languagePairBuilder_ == null) { + languages_ = builderForValue.build(); + onChanged(); + } else { + languagePairBuilder_.setMessage(builderForValue.build()); + } + languagesCase_ = 3; + return this; + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public Builder mergeLanguagePair( + com.google.cloud.translate.v3.Glossary.LanguageCodePair value) { + if (languagePairBuilder_ == null) { + if (languagesCase_ == 3 + && languages_ + != com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance()) { + languages_ = + com.google.cloud.translate.v3.Glossary.LanguageCodePair.newBuilder( + (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_) + .mergeFrom(value) + .buildPartial(); + } else { + languages_ = value; + } + onChanged(); + } else { + if (languagesCase_ == 3) { + languagePairBuilder_.mergeFrom(value); + } + languagePairBuilder_.setMessage(value); + } + languagesCase_ = 3; + return this; + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public Builder clearLanguagePair() { + if (languagePairBuilder_ == null) { + if (languagesCase_ == 3) { + languagesCase_ = 0; + languages_ = null; + onChanged(); + } + } else { + if (languagesCase_ == 3) { + languagesCase_ = 0; + languages_ = null; + } + languagePairBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodePair.Builder + getLanguagePairBuilder() { + return getLanguagePairFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodePairOrBuilder + getLanguagePairOrBuilder() { + if ((languagesCase_ == 3) && (languagePairBuilder_ != null)) { + return languagePairBuilder_.getMessageOrBuilder(); + } else { + if (languagesCase_ == 3) { + return (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_; + } + return com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance(); + } + } + /** + * + * + *
+     * Used with unidirectional glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary.LanguageCodePair, + com.google.cloud.translate.v3.Glossary.LanguageCodePair.Builder, + com.google.cloud.translate.v3.Glossary.LanguageCodePairOrBuilder> + getLanguagePairFieldBuilder() { + if (languagePairBuilder_ == null) { + if (!(languagesCase_ == 3)) { + languages_ = com.google.cloud.translate.v3.Glossary.LanguageCodePair.getDefaultInstance(); + } + languagePairBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary.LanguageCodePair, + com.google.cloud.translate.v3.Glossary.LanguageCodePair.Builder, + com.google.cloud.translate.v3.Glossary.LanguageCodePairOrBuilder>( + (com.google.cloud.translate.v3.Glossary.LanguageCodePair) languages_, + getParentForChildren(), + isClean()); + languages_ = null; + } + languagesCase_ = 3; + onChanged(); + ; + return languagePairBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary.LanguageCodesSet, + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.Builder, + com.google.cloud.translate.v3.Glossary.LanguageCodesSetOrBuilder> + languageCodesSetBuilder_; + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public boolean hasLanguageCodesSet() { + return languagesCase_ == 4; + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodesSet getLanguageCodesSet() { + if (languageCodesSetBuilder_ == null) { + if (languagesCase_ == 4) { + return (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_; + } + return com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance(); + } else { + if (languagesCase_ == 4) { + return languageCodesSetBuilder_.getMessage(); + } + return com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance(); + } + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public Builder setLanguageCodesSet( + com.google.cloud.translate.v3.Glossary.LanguageCodesSet value) { + if (languageCodesSetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + languages_ = value; + onChanged(); + } else { + languageCodesSetBuilder_.setMessage(value); + } + languagesCase_ = 4; + return this; + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public Builder setLanguageCodesSet( + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.Builder builderForValue) { + if (languageCodesSetBuilder_ == null) { + languages_ = builderForValue.build(); + onChanged(); + } else { + languageCodesSetBuilder_.setMessage(builderForValue.build()); + } + languagesCase_ = 4; + return this; + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public Builder mergeLanguageCodesSet( + com.google.cloud.translate.v3.Glossary.LanguageCodesSet value) { + if (languageCodesSetBuilder_ == null) { + if (languagesCase_ == 4 + && languages_ + != com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance()) { + languages_ = + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.newBuilder( + (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_) + .mergeFrom(value) + .buildPartial(); + } else { + languages_ = value; + } + onChanged(); + } else { + if (languagesCase_ == 4) { + languageCodesSetBuilder_.mergeFrom(value); + } + languageCodesSetBuilder_.setMessage(value); + } + languagesCase_ = 4; + return this; + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public Builder clearLanguageCodesSet() { + if (languageCodesSetBuilder_ == null) { + if (languagesCase_ == 4) { + languagesCase_ = 0; + languages_ = null; + onChanged(); + } + } else { + if (languagesCase_ == 4) { + languagesCase_ = 0; + languages_ = null; + } + languageCodesSetBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodesSet.Builder + getLanguageCodesSetBuilder() { + return getLanguageCodesSetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + public com.google.cloud.translate.v3.Glossary.LanguageCodesSetOrBuilder + getLanguageCodesSetOrBuilder() { + if ((languagesCase_ == 4) && (languageCodesSetBuilder_ != null)) { + return languageCodesSetBuilder_.getMessageOrBuilder(); + } else { + if (languagesCase_ == 4) { + return (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_; + } + return com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance(); + } + } + /** + * + * + *
+     * Used with equivalent term set glossaries.
+     * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary.LanguageCodesSet, + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.Builder, + com.google.cloud.translate.v3.Glossary.LanguageCodesSetOrBuilder> + getLanguageCodesSetFieldBuilder() { + if (languageCodesSetBuilder_ == null) { + if (!(languagesCase_ == 4)) { + languages_ = com.google.cloud.translate.v3.Glossary.LanguageCodesSet.getDefaultInstance(); + } + languageCodesSetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.Glossary.LanguageCodesSet, + com.google.cloud.translate.v3.Glossary.LanguageCodesSet.Builder, + com.google.cloud.translate.v3.Glossary.LanguageCodesSetOrBuilder>( + (com.google.cloud.translate.v3.Glossary.LanguageCodesSet) languages_, + getParentForChildren(), + isClean()); + languages_ = null; + } + languagesCase_ = 4; + onChanged(); + ; + return languageCodesSetBuilder_; + } + + private com.google.cloud.translate.v3.GlossaryInputConfig inputConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GlossaryInputConfig, + com.google.cloud.translate.v3.GlossaryInputConfig.Builder, + com.google.cloud.translate.v3.GlossaryInputConfigOrBuilder> + inputConfigBuilder_; + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public boolean hasInputConfig() { + return inputConfigBuilder_ != null || inputConfig_ != null; + } + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public com.google.cloud.translate.v3.GlossaryInputConfig getInputConfig() { + if (inputConfigBuilder_ == null) { + return inputConfig_ == null + ? com.google.cloud.translate.v3.GlossaryInputConfig.getDefaultInstance() + : inputConfig_; + } else { + return inputConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public Builder setInputConfig(com.google.cloud.translate.v3.GlossaryInputConfig value) { + if (inputConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + inputConfig_ = value; + onChanged(); + } else { + inputConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public Builder setInputConfig( + com.google.cloud.translate.v3.GlossaryInputConfig.Builder builderForValue) { + if (inputConfigBuilder_ == null) { + inputConfig_ = builderForValue.build(); + onChanged(); + } else { + inputConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public Builder mergeInputConfig(com.google.cloud.translate.v3.GlossaryInputConfig value) { + if (inputConfigBuilder_ == null) { + if (inputConfig_ != null) { + inputConfig_ = + com.google.cloud.translate.v3.GlossaryInputConfig.newBuilder(inputConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + inputConfig_ = value; + } + onChanged(); + } else { + inputConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public Builder clearInputConfig() { + if (inputConfigBuilder_ == null) { + inputConfig_ = null; + onChanged(); + } else { + inputConfig_ = null; + inputConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public com.google.cloud.translate.v3.GlossaryInputConfig.Builder getInputConfigBuilder() { + + onChanged(); + return getInputConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + public com.google.cloud.translate.v3.GlossaryInputConfigOrBuilder getInputConfigOrBuilder() { + if (inputConfigBuilder_ != null) { + return inputConfigBuilder_.getMessageOrBuilder(); + } else { + return inputConfig_ == null + ? com.google.cloud.translate.v3.GlossaryInputConfig.getDefaultInstance() + : inputConfig_; + } + } + /** + * + * + *
+     * Required. Provides examples to build the glossary from.
+     * Total glossary must not exceed 10M Unicode codepoints.
+     * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GlossaryInputConfig, + com.google.cloud.translate.v3.GlossaryInputConfig.Builder, + com.google.cloud.translate.v3.GlossaryInputConfigOrBuilder> + getInputConfigFieldBuilder() { + if (inputConfigBuilder_ == null) { + inputConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GlossaryInputConfig, + com.google.cloud.translate.v3.GlossaryInputConfig.Builder, + com.google.cloud.translate.v3.GlossaryInputConfigOrBuilder>( + getInputConfig(), getParentForChildren(), isClean()); + inputConfig_ = null; + } + return inputConfigBuilder_; + } + + private int entryCount_; + /** + * + * + *
+     * Output only. The number of entries defined in the glossary.
+     * 
+ * + * int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public int getEntryCount() { + return entryCount_; + } + /** + * + * + *
+     * Output only. The number of entries defined in the glossary.
+     * 
+ * + * int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder setEntryCount(int value) { + + entryCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The number of entries defined in the glossary.
+     * 
+ * + * int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder clearEntryCount() { + + entryCount_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp submitTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + submitTimeBuilder_; + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public boolean hasSubmitTime() { + return submitTimeBuilder_ != null || submitTime_ != null; + } + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp getSubmitTime() { + if (submitTimeBuilder_ == null) { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } else { + return submitTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + submitTime_ = value; + onChanged(); + } else { + submitTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setSubmitTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (submitTimeBuilder_ == null) { + submitTime_ = builderForValue.build(); + onChanged(); + } else { + submitTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeSubmitTime(com.google.protobuf.Timestamp value) { + if (submitTimeBuilder_ == null) { + if (submitTime_ != null) { + submitTime_ = + com.google.protobuf.Timestamp.newBuilder(submitTime_).mergeFrom(value).buildPartial(); + } else { + submitTime_ = value; + } + onChanged(); + } else { + submitTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearSubmitTime() { + if (submitTimeBuilder_ == null) { + submitTime_ = null; + onChanged(); + } else { + submitTime_ = null; + submitTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getSubmitTimeBuilder() { + + onChanged(); + return getSubmitTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder() { + if (submitTimeBuilder_ != null) { + return submitTimeBuilder_.getMessageOrBuilder(); + } else { + return submitTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : submitTime_; + } + } + /** + * + * + *
+     * Output only. When CreateGlossary was called.
+     * 
+ * + * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getSubmitTimeFieldBuilder() { + if (submitTimeBuilder_ == null) { + submitTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getSubmitTime(), getParentForChildren(), isClean()); + submitTime_ = null; + } + return submitTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public boolean hasEndTime() { + return endTimeBuilder_ != null || endTime_ != null; + } + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + onChanged(); + } else { + endTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + onChanged(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (endTime_ != null) { + endTime_ = + com.google.protobuf.Timestamp.newBuilder(endTime_).mergeFrom(value).buildPartial(); + } else { + endTime_ = value; + } + onChanged(); + } else { + endTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearEndTime() { + if (endTimeBuilder_ == null) { + endTime_ = null; + onChanged(); + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+     * Output only. When the glossary creation was finished.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.Glossary) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.Glossary) + private static final com.google.cloud.translate.v3.Glossary DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.Glossary(); + } + + public static com.google.cloud.translate.v3.Glossary getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Glossary parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Glossary(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Glossary getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryInputConfig.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryInputConfig.java new file mode 100644 index 00000000..fc96b198 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryInputConfig.java @@ -0,0 +1,1000 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Input configuration for glossaries.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GlossaryInputConfig} + */ +public final class GlossaryInputConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.GlossaryInputConfig) + GlossaryInputConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use GlossaryInputConfig.newBuilder() to construct. + private GlossaryInputConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GlossaryInputConfig() {} + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GlossaryInputConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.translate.v3.GcsSource.Builder subBuilder = null; + if (sourceCase_ == 1) { + subBuilder = ((com.google.cloud.translate.v3.GcsSource) source_).toBuilder(); + } + source_ = + input.readMessage( + com.google.cloud.translate.v3.GcsSource.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.translate.v3.GcsSource) source_); + source_ = subBuilder.buildPartial(); + } + sourceCase_ = 1; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GlossaryInputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GlossaryInputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GlossaryInputConfig.class, + com.google.cloud.translate.v3.GlossaryInputConfig.Builder.class); + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public enum SourceCase implements com.google.protobuf.Internal.EnumLite { + GCS_SOURCE(1), + SOURCE_NOT_SET(0); + private final int value; + + private SourceCase(int value) { + this.value = value; + } + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static SourceCase valueOf(int value) { + return forNumber(value); + } + + public static SourceCase forNumber(int value) { + switch (value) { + case 1: + return GCS_SOURCE; + case 0: + return SOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public static final int GCS_SOURCE_FIELD_NUMBER = 1; + /** + * + * + *
+   * Required. Google Cloud Storage location of glossary data.
+   * File format is determined based on the filename extension. API returns
+   * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+   * formats. Wildcards are not allowed. This must be a single file in one of
+   * the following formats:
+   * For unidirectional glossaries:
+   * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+   *   The first column is source text. The second column is target text.
+   *   The file must not contain headers. That is, the first row is data, not
+   *   column names.
+   * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+   * pairs.
+   * For equivalent term sets glossaries:
+   * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+   *   in multiple languages. The format is defined for Google Translation
+   *   Toolkit and documented in [Use a
+   *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public boolean hasGcsSource() { + return sourceCase_ == 1; + } + /** + * + * + *
+   * Required. Google Cloud Storage location of glossary data.
+   * File format is determined based on the filename extension. API returns
+   * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+   * formats. Wildcards are not allowed. This must be a single file in one of
+   * the following formats:
+   * For unidirectional glossaries:
+   * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+   *   The first column is source text. The second column is target text.
+   *   The file must not contain headers. That is, the first row is data, not
+   *   column names.
+   * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+   * pairs.
+   * For equivalent term sets glossaries:
+   * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+   *   in multiple languages. The format is defined for Google Translation
+   *   Toolkit and documented in [Use a
+   *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public com.google.cloud.translate.v3.GcsSource getGcsSource() { + if (sourceCase_ == 1) { + return (com.google.cloud.translate.v3.GcsSource) source_; + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + /** + * + * + *
+   * Required. Google Cloud Storage location of glossary data.
+   * File format is determined based on the filename extension. API returns
+   * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+   * formats. Wildcards are not allowed. This must be a single file in one of
+   * the following formats:
+   * For unidirectional glossaries:
+   * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+   *   The first column is source text. The second column is target text.
+   *   The file must not contain headers. That is, the first row is data, not
+   *   column names.
+   * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+   * pairs.
+   * For equivalent term sets glossaries:
+   * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+   *   in multiple languages. The format is defined for Google Translation
+   *   Toolkit and documented in [Use a
+   *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public com.google.cloud.translate.v3.GcsSourceOrBuilder getGcsSourceOrBuilder() { + if (sourceCase_ == 1) { + return (com.google.cloud.translate.v3.GcsSource) source_; + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (sourceCase_ == 1) { + output.writeMessage(1, (com.google.cloud.translate.v3.GcsSource) source_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (sourceCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.cloud.translate.v3.GcsSource) source_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.GlossaryInputConfig)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.GlossaryInputConfig other = + (com.google.cloud.translate.v3.GlossaryInputConfig) obj; + + if (!getSourceCase().equals(other.getSourceCase())) return false; + switch (sourceCase_) { + case 1: + if (!getGcsSource().equals(other.getGcsSource())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (sourceCase_) { + case 1: + hash = (37 * hash) + GCS_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getGcsSource().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.GlossaryInputConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Input configuration for glossaries.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.GlossaryInputConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.GlossaryInputConfig) + com.google.cloud.translate.v3.GlossaryInputConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GlossaryInputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GlossaryInputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.GlossaryInputConfig.class, + com.google.cloud.translate.v3.GlossaryInputConfig.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.GlossaryInputConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + sourceCase_ = 0; + source_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_GlossaryInputConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GlossaryInputConfig getDefaultInstanceForType() { + return com.google.cloud.translate.v3.GlossaryInputConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.GlossaryInputConfig build() { + com.google.cloud.translate.v3.GlossaryInputConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GlossaryInputConfig buildPartial() { + com.google.cloud.translate.v3.GlossaryInputConfig result = + new com.google.cloud.translate.v3.GlossaryInputConfig(this); + if (sourceCase_ == 1) { + if (gcsSourceBuilder_ == null) { + result.source_ = source_; + } else { + result.source_ = gcsSourceBuilder_.build(); + } + } + result.sourceCase_ = sourceCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.GlossaryInputConfig) { + return mergeFrom((com.google.cloud.translate.v3.GlossaryInputConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.GlossaryInputConfig other) { + if (other == com.google.cloud.translate.v3.GlossaryInputConfig.getDefaultInstance()) + return this; + switch (other.getSourceCase()) { + case GCS_SOURCE: + { + mergeGcsSource(other.getGcsSource()); + break; + } + case SOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.GlossaryInputConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.GlossaryInputConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public Builder clearSource() { + sourceCase_ = 0; + source_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsSource, + com.google.cloud.translate.v3.GcsSource.Builder, + com.google.cloud.translate.v3.GcsSourceOrBuilder> + gcsSourceBuilder_; + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public boolean hasGcsSource() { + return sourceCase_ == 1; + } + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public com.google.cloud.translate.v3.GcsSource getGcsSource() { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 1) { + return (com.google.cloud.translate.v3.GcsSource) source_; + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } else { + if (sourceCase_ == 1) { + return gcsSourceBuilder_.getMessage(); + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public Builder setGcsSource(com.google.cloud.translate.v3.GcsSource value) { + if (gcsSourceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + gcsSourceBuilder_.setMessage(value); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public Builder setGcsSource(com.google.cloud.translate.v3.GcsSource.Builder builderForValue) { + if (gcsSourceBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + gcsSourceBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public Builder mergeGcsSource(com.google.cloud.translate.v3.GcsSource value) { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 1 + && source_ != com.google.cloud.translate.v3.GcsSource.getDefaultInstance()) { + source_ = + com.google.cloud.translate.v3.GcsSource.newBuilder( + (com.google.cloud.translate.v3.GcsSource) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 1) { + gcsSourceBuilder_.mergeFrom(value); + } + gcsSourceBuilder_.setMessage(value); + } + sourceCase_ = 1; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public Builder clearGcsSource() { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 1) { + sourceCase_ = 0; + source_ = null; + } + gcsSourceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public com.google.cloud.translate.v3.GcsSource.Builder getGcsSourceBuilder() { + return getGcsSourceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + public com.google.cloud.translate.v3.GcsSourceOrBuilder getGcsSourceOrBuilder() { + if ((sourceCase_ == 1) && (gcsSourceBuilder_ != null)) { + return gcsSourceBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 1) { + return (com.google.cloud.translate.v3.GcsSource) source_; + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. Google Cloud Storage location of glossary data.
+     * File format is determined based on the filename extension. API returns
+     * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+     * formats. Wildcards are not allowed. This must be a single file in one of
+     * the following formats:
+     * For unidirectional glossaries:
+     * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+     *   The first column is source text. The second column is target text.
+     *   The file must not contain headers. That is, the first row is data, not
+     *   column names.
+     * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+     * pairs.
+     * For equivalent term sets glossaries:
+     * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+     *   in multiple languages. The format is defined for Google Translation
+     *   Toolkit and documented in [Use a
+     *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsSource, + com.google.cloud.translate.v3.GcsSource.Builder, + com.google.cloud.translate.v3.GcsSourceOrBuilder> + getGcsSourceFieldBuilder() { + if (gcsSourceBuilder_ == null) { + if (!(sourceCase_ == 1)) { + source_ = com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + gcsSourceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsSource, + com.google.cloud.translate.v3.GcsSource.Builder, + com.google.cloud.translate.v3.GcsSourceOrBuilder>( + (com.google.cloud.translate.v3.GcsSource) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 1; + onChanged(); + ; + return gcsSourceBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.GlossaryInputConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.GlossaryInputConfig) + private static final com.google.cloud.translate.v3.GlossaryInputConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.GlossaryInputConfig(); + } + + public static com.google.cloud.translate.v3.GlossaryInputConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GlossaryInputConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GlossaryInputConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.GlossaryInputConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryInputConfigOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryInputConfigOrBuilder.java new file mode 100644 index 00000000..61519d4d --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryInputConfigOrBuilder.java @@ -0,0 +1,106 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface GlossaryInputConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.GlossaryInputConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Google Cloud Storage location of glossary data.
+   * File format is determined based on the filename extension. API returns
+   * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+   * formats. Wildcards are not allowed. This must be a single file in one of
+   * the following formats:
+   * For unidirectional glossaries:
+   * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+   *   The first column is source text. The second column is target text.
+   *   The file must not contain headers. That is, the first row is data, not
+   *   column names.
+   * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+   * pairs.
+   * For equivalent term sets glossaries:
+   * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+   *   in multiple languages. The format is defined for Google Translation
+   *   Toolkit and documented in [Use a
+   *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + boolean hasGcsSource(); + /** + * + * + *
+   * Required. Google Cloud Storage location of glossary data.
+   * File format is determined based on the filename extension. API returns
+   * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+   * formats. Wildcards are not allowed. This must be a single file in one of
+   * the following formats:
+   * For unidirectional glossaries:
+   * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+   *   The first column is source text. The second column is target text.
+   *   The file must not contain headers. That is, the first row is data, not
+   *   column names.
+   * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+   * pairs.
+   * For equivalent term sets glossaries:
+   * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+   *   in multiple languages. The format is defined for Google Translation
+   *   Toolkit and documented in [Use a
+   *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + com.google.cloud.translate.v3.GcsSource getGcsSource(); + /** + * + * + *
+   * Required. Google Cloud Storage location of glossary data.
+   * File format is determined based on the filename extension. API returns
+   * [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file
+   * formats. Wildcards are not allowed. This must be a single file in one of
+   * the following formats:
+   * For unidirectional glossaries:
+   * - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated.
+   *   The first column is source text. The second column is target text.
+   *   The file must not contain headers. That is, the first row is data, not
+   *   column names.
+   * - TMX (`.tmx`): TMX file with parallel data defining source/target term
+   * pairs.
+   * For equivalent term sets glossaries:
+   * - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms
+   *   in multiple languages. The format is defined for Google Translation
+   *   Toolkit and documented in [Use a
+   *   glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en).
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 1; + */ + com.google.cloud.translate.v3.GcsSourceOrBuilder getGcsSourceOrBuilder(); + + public com.google.cloud.translate.v3.GlossaryInputConfig.SourceCase getSourceCase(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryName.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryName.java new file mode 100644 index 00000000..5690c89f --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryName.java @@ -0,0 +1,211 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate.v3; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class GlossaryName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/glossaries/{glossary}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String location; + private final String glossary; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getGlossary() { + return glossary; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private GlossaryName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + glossary = Preconditions.checkNotNull(builder.getGlossary()); + } + + public static GlossaryName of(String project, String location, String glossary) { + return newBuilder().setProject(project).setLocation(location).setGlossary(glossary).build(); + } + + public static String format(String project, String location, String glossary) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setGlossary(glossary) + .build() + .toString(); + } + + public static GlossaryName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "GlossaryName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("glossary")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (GlossaryName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("location", location); + fieldMapBuilder.put("glossary", glossary); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate( + "project", project, "location", location, "glossary", glossary); + } + + /** Builder for GlossaryName. */ + public static class Builder { + + private String project; + private String location; + private String glossary; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getGlossary() { + return glossary; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setGlossary(String glossary) { + this.glossary = glossary; + return this; + } + + private Builder() {} + + private Builder(GlossaryName glossaryName) { + project = glossaryName.project; + location = glossaryName.location; + glossary = glossaryName.glossary; + } + + public GlossaryName build() { + return new GlossaryName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof GlossaryName) { + GlossaryName that = (GlossaryName) o; + return (this.project.equals(that.project)) + && (this.location.equals(that.location)) + && (this.glossary.equals(that.glossary)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= location.hashCode(); + h *= 1000003; + h ^= glossary.hashCode(); + return h; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryOrBuilder.java new file mode 100644 index 00000000..58c6f8af --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/GlossaryOrBuilder.java @@ -0,0 +1,225 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface GlossaryOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.Glossary) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the glossary. Glossary names have the form
+   * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the glossary. Glossary names have the form
+   * `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Used with unidirectional glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + boolean hasLanguagePair(); + /** + * + * + *
+   * Used with unidirectional glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + com.google.cloud.translate.v3.Glossary.LanguageCodePair getLanguagePair(); + /** + * + * + *
+   * Used with unidirectional glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodePair language_pair = 3; + */ + com.google.cloud.translate.v3.Glossary.LanguageCodePairOrBuilder getLanguagePairOrBuilder(); + + /** + * + * + *
+   * Used with equivalent term set glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + boolean hasLanguageCodesSet(); + /** + * + * + *
+   * Used with equivalent term set glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + com.google.cloud.translate.v3.Glossary.LanguageCodesSet getLanguageCodesSet(); + /** + * + * + *
+   * Used with equivalent term set glossaries.
+   * 
+ * + * .google.cloud.translation.v3.Glossary.LanguageCodesSet language_codes_set = 4; + */ + com.google.cloud.translate.v3.Glossary.LanguageCodesSetOrBuilder getLanguageCodesSetOrBuilder(); + + /** + * + * + *
+   * Required. Provides examples to build the glossary from.
+   * Total glossary must not exceed 10M Unicode codepoints.
+   * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + boolean hasInputConfig(); + /** + * + * + *
+   * Required. Provides examples to build the glossary from.
+   * Total glossary must not exceed 10M Unicode codepoints.
+   * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + com.google.cloud.translate.v3.GlossaryInputConfig getInputConfig(); + /** + * + * + *
+   * Required. Provides examples to build the glossary from.
+   * Total glossary must not exceed 10M Unicode codepoints.
+   * 
+ * + * .google.cloud.translation.v3.GlossaryInputConfig input_config = 5; + */ + com.google.cloud.translate.v3.GlossaryInputConfigOrBuilder getInputConfigOrBuilder(); + + /** + * + * + *
+   * Output only. The number of entries defined in the glossary.
+   * 
+ * + * int32 entry_count = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + int getEntryCount(); + + /** + * + * + *
+   * Output only. When CreateGlossary was called.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + boolean hasSubmitTime(); + /** + * + * + *
+   * Output only. When CreateGlossary was called.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.Timestamp getSubmitTime(); + /** + * + * + *
+   * Output only. When CreateGlossary was called.
+   * 
+ * + * .google.protobuf.Timestamp submit_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getSubmitTimeOrBuilder(); + + /** + * + * + *
+   * Output only. When the glossary creation was finished.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + boolean hasEndTime(); + /** + * + * + *
+   * Output only. When the glossary creation was finished.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+   * Output only. When the glossary creation was finished.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); + + public com.google.cloud.translate.v3.Glossary.LanguagesCase getLanguagesCase(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/InputConfig.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/InputConfig.java new file mode 100644 index 00000000..75f911cd --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/InputConfig.java @@ -0,0 +1,1169 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Input configuration for BatchTranslateText request.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.InputConfig} + */ +public final class InputConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.InputConfig) + InputConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use InputConfig.newBuilder() to construct. + private InputConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private InputConfig() { + mimeType_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private InputConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + mimeType_ = s; + break; + } + case 18: + { + com.google.cloud.translate.v3.GcsSource.Builder subBuilder = null; + if (sourceCase_ == 2) { + subBuilder = ((com.google.cloud.translate.v3.GcsSource) source_).toBuilder(); + } + source_ = + input.readMessage( + com.google.cloud.translate.v3.GcsSource.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.translate.v3.GcsSource) source_); + source_ = subBuilder.buildPartial(); + } + sourceCase_ = 2; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_InputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_InputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.InputConfig.class, + com.google.cloud.translate.v3.InputConfig.Builder.class); + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public enum SourceCase implements com.google.protobuf.Internal.EnumLite { + GCS_SOURCE(2), + SOURCE_NOT_SET(0); + private final int value; + + private SourceCase(int value) { + this.value = value; + } + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static SourceCase valueOf(int value) { + return forNumber(value); + } + + public static SourceCase forNumber(int value) { + switch (value) { + case 2: + return GCS_SOURCE; + case 0: + return SOURCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public static final int MIME_TYPE_FIELD_NUMBER = 1; + private volatile java.lang.Object mimeType_; + /** + * + * + *
+   * Optional. Can be "text/plain" or "text/html".
+   * For `.tsv`, "text/html" is used if mime_type is missing.
+   * For `.html`, this field must be "text/html" or empty.
+   * For `.txt`, this field must be "text/plain" or empty.
+   * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Can be "text/plain" or "text/html".
+   * For `.tsv`, "text/html" is used if mime_type is missing.
+   * For `.html`, this field must be "text/html" or empty.
+   * For `.txt`, this field must be "text/plain" or empty.
+   * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GCS_SOURCE_FIELD_NUMBER = 2; + /** + * + * + *
+   * Required. Google Cloud Storage location for the source input.
+   * This can be a single file (for example,
+   * `gs://translation-test/input.tsv`) or a wildcard (for example,
+   * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+   * contain either one or two columns. The first column (optional) is the id
+   * of the text request. If the first column is missing, we use the row
+   * number (0-based) from the input file as the ID in the output file. The
+   * second column is the actual text to be
+   *  translated. We recommend each row be <= 10K Unicode codepoints,
+   * otherwise an error might be returned.
+   * Note that the input tsv must be RFC 4180 compliant.
+   * You could use https://github.com/Clever/csvlint to check potential
+   * formatting errors in your tsv file.
+   * csvlint --delimiter='\t' your_input_file.tsv
+   * The other supported file extensions are `.txt` or `.html`, which is
+   * treated as a single large chunk of text.
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public boolean hasGcsSource() { + return sourceCase_ == 2; + } + /** + * + * + *
+   * Required. Google Cloud Storage location for the source input.
+   * This can be a single file (for example,
+   * `gs://translation-test/input.tsv`) or a wildcard (for example,
+   * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+   * contain either one or two columns. The first column (optional) is the id
+   * of the text request. If the first column is missing, we use the row
+   * number (0-based) from the input file as the ID in the output file. The
+   * second column is the actual text to be
+   *  translated. We recommend each row be <= 10K Unicode codepoints,
+   * otherwise an error might be returned.
+   * Note that the input tsv must be RFC 4180 compliant.
+   * You could use https://github.com/Clever/csvlint to check potential
+   * formatting errors in your tsv file.
+   * csvlint --delimiter='\t' your_input_file.tsv
+   * The other supported file extensions are `.txt` or `.html`, which is
+   * treated as a single large chunk of text.
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public com.google.cloud.translate.v3.GcsSource getGcsSource() { + if (sourceCase_ == 2) { + return (com.google.cloud.translate.v3.GcsSource) source_; + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + /** + * + * + *
+   * Required. Google Cloud Storage location for the source input.
+   * This can be a single file (for example,
+   * `gs://translation-test/input.tsv`) or a wildcard (for example,
+   * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+   * contain either one or two columns. The first column (optional) is the id
+   * of the text request. If the first column is missing, we use the row
+   * number (0-based) from the input file as the ID in the output file. The
+   * second column is the actual text to be
+   *  translated. We recommend each row be <= 10K Unicode codepoints,
+   * otherwise an error might be returned.
+   * Note that the input tsv must be RFC 4180 compliant.
+   * You could use https://github.com/Clever/csvlint to check potential
+   * formatting errors in your tsv file.
+   * csvlint --delimiter='\t' your_input_file.tsv
+   * The other supported file extensions are `.txt` or `.html`, which is
+   * treated as a single large chunk of text.
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public com.google.cloud.translate.v3.GcsSourceOrBuilder getGcsSourceOrBuilder() { + if (sourceCase_ == 2) { + return (com.google.cloud.translate.v3.GcsSource) source_; + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getMimeTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, mimeType_); + } + if (sourceCase_ == 2) { + output.writeMessage(2, (com.google.cloud.translate.v3.GcsSource) source_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getMimeTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, mimeType_); + } + if (sourceCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.cloud.translate.v3.GcsSource) source_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.InputConfig)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.InputConfig other = + (com.google.cloud.translate.v3.InputConfig) obj; + + if (!getMimeType().equals(other.getMimeType())) return false; + if (!getSourceCase().equals(other.getSourceCase())) return false; + switch (sourceCase_) { + case 2: + if (!getGcsSource().equals(other.getGcsSource())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getMimeType().hashCode(); + switch (sourceCase_) { + case 2: + hash = (37 * hash) + GCS_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getGcsSource().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.InputConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.InputConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.InputConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.InputConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Input configuration for BatchTranslateText request.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.InputConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.InputConfig) + com.google.cloud.translate.v3.InputConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_InputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_InputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.InputConfig.class, + com.google.cloud.translate.v3.InputConfig.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.InputConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + mimeType_ = ""; + + sourceCase_ = 0; + source_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_InputConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.InputConfig getDefaultInstanceForType() { + return com.google.cloud.translate.v3.InputConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.InputConfig build() { + com.google.cloud.translate.v3.InputConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.InputConfig buildPartial() { + com.google.cloud.translate.v3.InputConfig result = + new com.google.cloud.translate.v3.InputConfig(this); + result.mimeType_ = mimeType_; + if (sourceCase_ == 2) { + if (gcsSourceBuilder_ == null) { + result.source_ = source_; + } else { + result.source_ = gcsSourceBuilder_.build(); + } + } + result.sourceCase_ = sourceCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.InputConfig) { + return mergeFrom((com.google.cloud.translate.v3.InputConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.InputConfig other) { + if (other == com.google.cloud.translate.v3.InputConfig.getDefaultInstance()) return this; + if (!other.getMimeType().isEmpty()) { + mimeType_ = other.mimeType_; + onChanged(); + } + switch (other.getSourceCase()) { + case GCS_SOURCE: + { + mergeGcsSource(other.getGcsSource()); + break; + } + case SOURCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.InputConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.InputConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int sourceCase_ = 0; + private java.lang.Object source_; + + public SourceCase getSourceCase() { + return SourceCase.forNumber(sourceCase_); + } + + public Builder clearSource() { + sourceCase_ = 0; + source_ = null; + onChanged(); + return this; + } + + private java.lang.Object mimeType_ = ""; + /** + * + * + *
+     * Optional. Can be "text/plain" or "text/html".
+     * For `.tsv`, "text/html" is used if mime_type is missing.
+     * For `.html`, this field must be "text/html" or empty.
+     * For `.txt`, this field must be "text/plain" or empty.
+     * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Can be "text/plain" or "text/html".
+     * For `.tsv`, "text/html" is used if mime_type is missing.
+     * For `.html`, this field must be "text/html" or empty.
+     * For `.txt`, this field must be "text/plain" or empty.
+     * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Can be "text/plain" or "text/html".
+     * For `.tsv`, "text/html" is used if mime_type is missing.
+     * For `.html`, this field must be "text/html" or empty.
+     * For `.txt`, this field must be "text/plain" or empty.
+     * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setMimeType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + mimeType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Can be "text/plain" or "text/html".
+     * For `.tsv`, "text/html" is used if mime_type is missing.
+     * For `.html`, this field must be "text/html" or empty.
+     * For `.txt`, this field must be "text/plain" or empty.
+     * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearMimeType() { + + mimeType_ = getDefaultInstance().getMimeType(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Can be "text/plain" or "text/html".
+     * For `.tsv`, "text/html" is used if mime_type is missing.
+     * For `.html`, this field must be "text/html" or empty.
+     * For `.txt`, this field must be "text/plain" or empty.
+     * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setMimeTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + mimeType_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsSource, + com.google.cloud.translate.v3.GcsSource.Builder, + com.google.cloud.translate.v3.GcsSourceOrBuilder> + gcsSourceBuilder_; + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public boolean hasGcsSource() { + return sourceCase_ == 2; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public com.google.cloud.translate.v3.GcsSource getGcsSource() { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2) { + return (com.google.cloud.translate.v3.GcsSource) source_; + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } else { + if (sourceCase_ == 2) { + return gcsSourceBuilder_.getMessage(); + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public Builder setGcsSource(com.google.cloud.translate.v3.GcsSource value) { + if (gcsSourceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + source_ = value; + onChanged(); + } else { + gcsSourceBuilder_.setMessage(value); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public Builder setGcsSource(com.google.cloud.translate.v3.GcsSource.Builder builderForValue) { + if (gcsSourceBuilder_ == null) { + source_ = builderForValue.build(); + onChanged(); + } else { + gcsSourceBuilder_.setMessage(builderForValue.build()); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public Builder mergeGcsSource(com.google.cloud.translate.v3.GcsSource value) { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2 + && source_ != com.google.cloud.translate.v3.GcsSource.getDefaultInstance()) { + source_ = + com.google.cloud.translate.v3.GcsSource.newBuilder( + (com.google.cloud.translate.v3.GcsSource) source_) + .mergeFrom(value) + .buildPartial(); + } else { + source_ = value; + } + onChanged(); + } else { + if (sourceCase_ == 2) { + gcsSourceBuilder_.mergeFrom(value); + } + gcsSourceBuilder_.setMessage(value); + } + sourceCase_ = 2; + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public Builder clearGcsSource() { + if (gcsSourceBuilder_ == null) { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + onChanged(); + } + } else { + if (sourceCase_ == 2) { + sourceCase_ = 0; + source_ = null; + } + gcsSourceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public com.google.cloud.translate.v3.GcsSource.Builder getGcsSourceBuilder() { + return getGcsSourceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + public com.google.cloud.translate.v3.GcsSourceOrBuilder getGcsSourceOrBuilder() { + if ((sourceCase_ == 2) && (gcsSourceBuilder_ != null)) { + return gcsSourceBuilder_.getMessageOrBuilder(); + } else { + if (sourceCase_ == 2) { + return (com.google.cloud.translate.v3.GcsSource) source_; + } + return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + } + /** + * + * + *
+     * Required. Google Cloud Storage location for the source input.
+     * This can be a single file (for example,
+     * `gs://translation-test/input.tsv`) or a wildcard (for example,
+     * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+     * contain either one or two columns. The first column (optional) is the id
+     * of the text request. If the first column is missing, we use the row
+     * number (0-based) from the input file as the ID in the output file. The
+     * second column is the actual text to be
+     *  translated. We recommend each row be <= 10K Unicode codepoints,
+     * otherwise an error might be returned.
+     * Note that the input tsv must be RFC 4180 compliant.
+     * You could use https://github.com/Clever/csvlint to check potential
+     * formatting errors in your tsv file.
+     * csvlint --delimiter='\t' your_input_file.tsv
+     * The other supported file extensions are `.txt` or `.html`, which is
+     * treated as a single large chunk of text.
+     * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsSource, + com.google.cloud.translate.v3.GcsSource.Builder, + com.google.cloud.translate.v3.GcsSourceOrBuilder> + getGcsSourceFieldBuilder() { + if (gcsSourceBuilder_ == null) { + if (!(sourceCase_ == 2)) { + source_ = com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); + } + gcsSourceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsSource, + com.google.cloud.translate.v3.GcsSource.Builder, + com.google.cloud.translate.v3.GcsSourceOrBuilder>( + (com.google.cloud.translate.v3.GcsSource) source_, + getParentForChildren(), + isClean()); + source_ = null; + } + sourceCase_ = 2; + onChanged(); + ; + return gcsSourceBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.InputConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.InputConfig) + private static final com.google.cloud.translate.v3.InputConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.InputConfig(); + } + + public static com.google.cloud.translate.v3.InputConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public InputConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new InputConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.InputConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/InputConfigOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/InputConfigOrBuilder.java new file mode 100644 index 00000000..104dea56 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/InputConfigOrBuilder.java @@ -0,0 +1,130 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface InputConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.InputConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. Can be "text/plain" or "text/html".
+   * For `.tsv`, "text/html" is used if mime_type is missing.
+   * For `.html`, this field must be "text/html" or empty.
+   * For `.txt`, this field must be "text/plain" or empty.
+   * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getMimeType(); + /** + * + * + *
+   * Optional. Can be "text/plain" or "text/html".
+   * For `.tsv`, "text/html" is used if mime_type is missing.
+   * For `.html`, this field must be "text/html" or empty.
+   * For `.txt`, this field must be "text/plain" or empty.
+   * 
+ * + * string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getMimeTypeBytes(); + + /** + * + * + *
+   * Required. Google Cloud Storage location for the source input.
+   * This can be a single file (for example,
+   * `gs://translation-test/input.tsv`) or a wildcard (for example,
+   * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+   * contain either one or two columns. The first column (optional) is the id
+   * of the text request. If the first column is missing, we use the row
+   * number (0-based) from the input file as the ID in the output file. The
+   * second column is the actual text to be
+   *  translated. We recommend each row be <= 10K Unicode codepoints,
+   * otherwise an error might be returned.
+   * Note that the input tsv must be RFC 4180 compliant.
+   * You could use https://github.com/Clever/csvlint to check potential
+   * formatting errors in your tsv file.
+   * csvlint --delimiter='\t' your_input_file.tsv
+   * The other supported file extensions are `.txt` or `.html`, which is
+   * treated as a single large chunk of text.
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + boolean hasGcsSource(); + /** + * + * + *
+   * Required. Google Cloud Storage location for the source input.
+   * This can be a single file (for example,
+   * `gs://translation-test/input.tsv`) or a wildcard (for example,
+   * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+   * contain either one or two columns. The first column (optional) is the id
+   * of the text request. If the first column is missing, we use the row
+   * number (0-based) from the input file as the ID in the output file. The
+   * second column is the actual text to be
+   *  translated. We recommend each row be <= 10K Unicode codepoints,
+   * otherwise an error might be returned.
+   * Note that the input tsv must be RFC 4180 compliant.
+   * You could use https://github.com/Clever/csvlint to check potential
+   * formatting errors in your tsv file.
+   * csvlint --delimiter='\t' your_input_file.tsv
+   * The other supported file extensions are `.txt` or `.html`, which is
+   * treated as a single large chunk of text.
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + com.google.cloud.translate.v3.GcsSource getGcsSource(); + /** + * + * + *
+   * Required. Google Cloud Storage location for the source input.
+   * This can be a single file (for example,
+   * `gs://translation-test/input.tsv`) or a wildcard (for example,
+   * `gs://translation-test/*`). If a file extension is `.tsv`, it can
+   * contain either one or two columns. The first column (optional) is the id
+   * of the text request. If the first column is missing, we use the row
+   * number (0-based) from the input file as the ID in the output file. The
+   * second column is the actual text to be
+   *  translated. We recommend each row be <= 10K Unicode codepoints,
+   * otherwise an error might be returned.
+   * Note that the input tsv must be RFC 4180 compliant.
+   * You could use https://github.com/Clever/csvlint to check potential
+   * formatting errors in your tsv file.
+   * csvlint --delimiter='\t' your_input_file.tsv
+   * The other supported file extensions are `.txt` or `.html`, which is
+   * treated as a single large chunk of text.
+   * 
+ * + * .google.cloud.translation.v3.GcsSource gcs_source = 2; + */ + com.google.cloud.translate.v3.GcsSourceOrBuilder getGcsSourceOrBuilder(); + + public com.google.cloud.translate.v3.InputConfig.SourceCase getSourceCase(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesRequest.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesRequest.java new file mode 100644 index 00000000..7a39fbbb --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesRequest.java @@ -0,0 +1,1067 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Request message for ListGlossaries.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.ListGlossariesRequest} + */ +public final class ListGlossariesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.ListGlossariesRequest) + ListGlossariesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListGlossariesRequest.newBuilder() to construct. + private ListGlossariesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListGlossariesRequest() { + parent_ = ""; + pageToken_ = ""; + filter_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListGlossariesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.ListGlossariesRequest.class, + com.google.cloud.translate.v3.ListGlossariesRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The name of the project from which to list all of the glossaries.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the project from which to list all of the glossaries.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Optional. Requested page size. The server may return fewer glossaries than
+   * requested. If unspecified, the server picks an appropriate default.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. A token identifying a page of results the server should return.
+   * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+   * returned from the previous call to `ListGlossaries` method.
+   * The first page is returned if `page_token`is empty or missing.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. A token identifying a page of results the server should return.
+   * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+   * returned from the previous call to `ListGlossaries` method.
+   * The first page is returned if `page_token`is empty or missing.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 4; + private volatile java.lang.Object filter_; + /** + * + * + *
+   * Optional. Filter specifying constraints of a list operation.
+   * Filtering is not supported yet, and the parameter currently has no effect.
+   * If missing, no filtering is performed.
+   * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Filter specifying constraints of a list operation.
+   * Filtering is not supported yet, and the parameter currently has no effect.
+   * If missing, no filtering is performed.
+   * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (!getFilterBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, filter_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (!getFilterBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, filter_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.ListGlossariesRequest)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.ListGlossariesRequest other = + (com.google.cloud.translate.v3.ListGlossariesRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getFilter().equals(other.getFilter())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.ListGlossariesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for ListGlossaries.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.ListGlossariesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.ListGlossariesRequest) + com.google.cloud.translate.v3.ListGlossariesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.ListGlossariesRequest.class, + com.google.cloud.translate.v3.ListGlossariesRequest.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.ListGlossariesRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + filter_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.ListGlossariesRequest getDefaultInstanceForType() { + return com.google.cloud.translate.v3.ListGlossariesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.ListGlossariesRequest build() { + com.google.cloud.translate.v3.ListGlossariesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.ListGlossariesRequest buildPartial() { + com.google.cloud.translate.v3.ListGlossariesRequest result = + new com.google.cloud.translate.v3.ListGlossariesRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.filter_ = filter_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.ListGlossariesRequest) { + return mergeFrom((com.google.cloud.translate.v3.ListGlossariesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.ListGlossariesRequest other) { + if (other == com.google.cloud.translate.v3.ListGlossariesRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.ListGlossariesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.ListGlossariesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The name of the project from which to list all of the glossaries.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the project from which to list all of the glossaries.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the project from which to list all of the glossaries.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the project from which to list all of the glossaries.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the project from which to list all of the glossaries.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. Requested page size. The server may return fewer glossaries than
+     * requested. If unspecified, the server picks an appropriate default.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. Requested page size. The server may return fewer glossaries than
+     * requested. If unspecified, the server picks an appropriate default.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Requested page size. The server may return fewer glossaries than
+     * requested. If unspecified, the server picks an appropriate default.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. A token identifying a page of results the server should return.
+     * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+     * returned from the previous call to `ListGlossaries` method.
+     * The first page is returned if `page_token`is empty or missing.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. A token identifying a page of results the server should return.
+     * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+     * returned from the previous call to `ListGlossaries` method.
+     * The first page is returned if `page_token`is empty or missing.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. A token identifying a page of results the server should return.
+     * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+     * returned from the previous call to `ListGlossaries` method.
+     * The first page is returned if `page_token`is empty or missing.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A token identifying a page of results the server should return.
+     * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+     * returned from the previous call to `ListGlossaries` method.
+     * The first page is returned if `page_token`is empty or missing.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A token identifying a page of results the server should return.
+     * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+     * returned from the previous call to `ListGlossaries` method.
+     * The first page is returned if `page_token`is empty or missing.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Optional. Filter specifying constraints of a list operation.
+     * Filtering is not supported yet, and the parameter currently has no effect.
+     * If missing, no filtering is performed.
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Filter specifying constraints of a list operation.
+     * Filtering is not supported yet, and the parameter currently has no effect.
+     * If missing, no filtering is performed.
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Filter specifying constraints of a list operation.
+     * Filtering is not supported yet, and the parameter currently has no effect.
+     * If missing, no filtering is performed.
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Filter specifying constraints of a list operation.
+     * Filtering is not supported yet, and the parameter currently has no effect.
+     * If missing, no filtering is performed.
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Filter specifying constraints of a list operation.
+     * Filtering is not supported yet, and the parameter currently has no effect.
+     * If missing, no filtering is performed.
+     * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.ListGlossariesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.ListGlossariesRequest) + private static final com.google.cloud.translate.v3.ListGlossariesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.ListGlossariesRequest(); + } + + public static com.google.cloud.translate.v3.ListGlossariesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListGlossariesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListGlossariesRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.ListGlossariesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesRequestOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesRequestOrBuilder.java new file mode 100644 index 00000000..0af35ac0 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesRequestOrBuilder.java @@ -0,0 +1,114 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface ListGlossariesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.ListGlossariesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the project from which to list all of the glossaries.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The name of the project from which to list all of the glossaries.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. Requested page size. The server may return fewer glossaries than
+   * requested. If unspecified, the server picks an appropriate default.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. A token identifying a page of results the server should return.
+   * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+   * returned from the previous call to `ListGlossaries` method.
+   * The first page is returned if `page_token`is empty or missing.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. A token identifying a page of results the server should return.
+   * Typically, this is the value of [ListGlossariesResponse.next_page_token]
+   * returned from the previous call to `ListGlossaries` method.
+   * The first page is returned if `page_token`is empty or missing.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Optional. Filter specifying constraints of a list operation.
+   * Filtering is not supported yet, and the parameter currently has no effect.
+   * If missing, no filtering is performed.
+   * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Optional. Filter specifying constraints of a list operation.
+   * Filtering is not supported yet, and the parameter currently has no effect.
+   * If missing, no filtering is performed.
+   * 
+ * + * string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getFilterBytes(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesResponse.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesResponse.java new file mode 100644 index 00000000..7e0729ec --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesResponse.java @@ -0,0 +1,1116 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Response message for ListGlossaries.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.ListGlossariesResponse} + */ +public final class ListGlossariesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.ListGlossariesResponse) + ListGlossariesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListGlossariesResponse.newBuilder() to construct. + private ListGlossariesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListGlossariesResponse() { + glossaries_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListGlossariesResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + glossaries_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + glossaries_.add( + input.readMessage( + com.google.cloud.translate.v3.Glossary.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + glossaries_ = java.util.Collections.unmodifiableList(glossaries_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.ListGlossariesResponse.class, + com.google.cloud.translate.v3.ListGlossariesResponse.Builder.class); + } + + private int bitField0_; + public static final int GLOSSARIES_FIELD_NUMBER = 1; + private java.util.List glossaries_; + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public java.util.List getGlossariesList() { + return glossaries_; + } + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public java.util.List + getGlossariesOrBuilderList() { + return glossaries_; + } + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public int getGlossariesCount() { + return glossaries_.size(); + } + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public com.google.cloud.translate.v3.Glossary getGlossaries(int index) { + return glossaries_.get(index); + } + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public com.google.cloud.translate.v3.GlossaryOrBuilder getGlossariesOrBuilder(int index) { + return glossaries_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token to retrieve a page of results. Pass this value in the
+   * [ListGlossariesRequest.page_token] field in the subsequent call to
+   * `ListGlossaries` method to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token to retrieve a page of results. Pass this value in the
+   * [ListGlossariesRequest.page_token] field in the subsequent call to
+   * `ListGlossaries` method to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < glossaries_.size(); i++) { + output.writeMessage(1, glossaries_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < glossaries_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, glossaries_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.ListGlossariesResponse)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.ListGlossariesResponse other = + (com.google.cloud.translate.v3.ListGlossariesResponse) obj; + + if (!getGlossariesList().equals(other.getGlossariesList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getGlossariesCount() > 0) { + hash = (37 * hash) + GLOSSARIES_FIELD_NUMBER; + hash = (53 * hash) + getGlossariesList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.ListGlossariesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for ListGlossaries.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.ListGlossariesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.ListGlossariesResponse) + com.google.cloud.translate.v3.ListGlossariesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.ListGlossariesResponse.class, + com.google.cloud.translate.v3.ListGlossariesResponse.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.ListGlossariesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getGlossariesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (glossariesBuilder_ == null) { + glossaries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + glossariesBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_ListGlossariesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.ListGlossariesResponse getDefaultInstanceForType() { + return com.google.cloud.translate.v3.ListGlossariesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.ListGlossariesResponse build() { + com.google.cloud.translate.v3.ListGlossariesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.ListGlossariesResponse buildPartial() { + com.google.cloud.translate.v3.ListGlossariesResponse result = + new com.google.cloud.translate.v3.ListGlossariesResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (glossariesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + glossaries_ = java.util.Collections.unmodifiableList(glossaries_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.glossaries_ = glossaries_; + } else { + result.glossaries_ = glossariesBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.ListGlossariesResponse) { + return mergeFrom((com.google.cloud.translate.v3.ListGlossariesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.ListGlossariesResponse other) { + if (other == com.google.cloud.translate.v3.ListGlossariesResponse.getDefaultInstance()) + return this; + if (glossariesBuilder_ == null) { + if (!other.glossaries_.isEmpty()) { + if (glossaries_.isEmpty()) { + glossaries_ = other.glossaries_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureGlossariesIsMutable(); + glossaries_.addAll(other.glossaries_); + } + onChanged(); + } + } else { + if (!other.glossaries_.isEmpty()) { + if (glossariesBuilder_.isEmpty()) { + glossariesBuilder_.dispose(); + glossariesBuilder_ = null; + glossaries_ = other.glossaries_; + bitField0_ = (bitField0_ & ~0x00000001); + glossariesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getGlossariesFieldBuilder() + : null; + } else { + glossariesBuilder_.addAllMessages(other.glossaries_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.ListGlossariesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.ListGlossariesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List glossaries_ = + java.util.Collections.emptyList(); + + private void ensureGlossariesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + glossaries_ = new java.util.ArrayList(glossaries_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Glossary, + com.google.cloud.translate.v3.Glossary.Builder, + com.google.cloud.translate.v3.GlossaryOrBuilder> + glossariesBuilder_; + + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public java.util.List getGlossariesList() { + if (glossariesBuilder_ == null) { + return java.util.Collections.unmodifiableList(glossaries_); + } else { + return glossariesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public int getGlossariesCount() { + if (glossariesBuilder_ == null) { + return glossaries_.size(); + } else { + return glossariesBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public com.google.cloud.translate.v3.Glossary getGlossaries(int index) { + if (glossariesBuilder_ == null) { + return glossaries_.get(index); + } else { + return glossariesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder setGlossaries(int index, com.google.cloud.translate.v3.Glossary value) { + if (glossariesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlossariesIsMutable(); + glossaries_.set(index, value); + onChanged(); + } else { + glossariesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder setGlossaries( + int index, com.google.cloud.translate.v3.Glossary.Builder builderForValue) { + if (glossariesBuilder_ == null) { + ensureGlossariesIsMutable(); + glossaries_.set(index, builderForValue.build()); + onChanged(); + } else { + glossariesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder addGlossaries(com.google.cloud.translate.v3.Glossary value) { + if (glossariesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlossariesIsMutable(); + glossaries_.add(value); + onChanged(); + } else { + glossariesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder addGlossaries(int index, com.google.cloud.translate.v3.Glossary value) { + if (glossariesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlossariesIsMutable(); + glossaries_.add(index, value); + onChanged(); + } else { + glossariesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder addGlossaries(com.google.cloud.translate.v3.Glossary.Builder builderForValue) { + if (glossariesBuilder_ == null) { + ensureGlossariesIsMutable(); + glossaries_.add(builderForValue.build()); + onChanged(); + } else { + glossariesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder addGlossaries( + int index, com.google.cloud.translate.v3.Glossary.Builder builderForValue) { + if (glossariesBuilder_ == null) { + ensureGlossariesIsMutable(); + glossaries_.add(index, builderForValue.build()); + onChanged(); + } else { + glossariesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder addAllGlossaries( + java.lang.Iterable values) { + if (glossariesBuilder_ == null) { + ensureGlossariesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, glossaries_); + onChanged(); + } else { + glossariesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder clearGlossaries() { + if (glossariesBuilder_ == null) { + glossaries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + glossariesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public Builder removeGlossaries(int index) { + if (glossariesBuilder_ == null) { + ensureGlossariesIsMutable(); + glossaries_.remove(index); + onChanged(); + } else { + glossariesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public com.google.cloud.translate.v3.Glossary.Builder getGlossariesBuilder(int index) { + return getGlossariesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public com.google.cloud.translate.v3.GlossaryOrBuilder getGlossariesOrBuilder(int index) { + if (glossariesBuilder_ == null) { + return glossaries_.get(index); + } else { + return glossariesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public java.util.List + getGlossariesOrBuilderList() { + if (glossariesBuilder_ != null) { + return glossariesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(glossaries_); + } + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public com.google.cloud.translate.v3.Glossary.Builder addGlossariesBuilder() { + return getGlossariesFieldBuilder() + .addBuilder(com.google.cloud.translate.v3.Glossary.getDefaultInstance()); + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public com.google.cloud.translate.v3.Glossary.Builder addGlossariesBuilder(int index) { + return getGlossariesFieldBuilder() + .addBuilder(index, com.google.cloud.translate.v3.Glossary.getDefaultInstance()); + } + /** + * + * + *
+     * The list of glossaries for a project.
+     * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + public java.util.List + getGlossariesBuilderList() { + return getGlossariesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Glossary, + com.google.cloud.translate.v3.Glossary.Builder, + com.google.cloud.translate.v3.GlossaryOrBuilder> + getGlossariesFieldBuilder() { + if (glossariesBuilder_ == null) { + glossariesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Glossary, + com.google.cloud.translate.v3.Glossary.Builder, + com.google.cloud.translate.v3.GlossaryOrBuilder>( + glossaries_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + glossaries_ = null; + } + return glossariesBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token to retrieve a page of results. Pass this value in the
+     * [ListGlossariesRequest.page_token] field in the subsequent call to
+     * `ListGlossaries` method to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token to retrieve a page of results. Pass this value in the
+     * [ListGlossariesRequest.page_token] field in the subsequent call to
+     * `ListGlossaries` method to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token to retrieve a page of results. Pass this value in the
+     * [ListGlossariesRequest.page_token] field in the subsequent call to
+     * `ListGlossaries` method to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve a page of results. Pass this value in the
+     * [ListGlossariesRequest.page_token] field in the subsequent call to
+     * `ListGlossaries` method to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve a page of results. Pass this value in the
+     * [ListGlossariesRequest.page_token] field in the subsequent call to
+     * `ListGlossaries` method to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.ListGlossariesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.ListGlossariesResponse) + private static final com.google.cloud.translate.v3.ListGlossariesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.ListGlossariesResponse(); + } + + public static com.google.cloud.translate.v3.ListGlossariesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListGlossariesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListGlossariesResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.ListGlossariesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesResponseOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesResponseOrBuilder.java new file mode 100644 index 00000000..c20dce94 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/ListGlossariesResponseOrBuilder.java @@ -0,0 +1,102 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface ListGlossariesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.ListGlossariesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + java.util.List getGlossariesList(); + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + com.google.cloud.translate.v3.Glossary getGlossaries(int index); + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + int getGlossariesCount(); + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + java.util.List + getGlossariesOrBuilderList(); + /** + * + * + *
+   * The list of glossaries for a project.
+   * 
+ * + * repeated .google.cloud.translation.v3.Glossary glossaries = 1; + */ + com.google.cloud.translate.v3.GlossaryOrBuilder getGlossariesOrBuilder(int index); + + /** + * + * + *
+   * A token to retrieve a page of results. Pass this value in the
+   * [ListGlossariesRequest.page_token] field in the subsequent call to
+   * `ListGlossaries` method to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token to retrieve a page of results. Pass this value in the
+   * [ListGlossariesRequest.page_token] field in the subsequent call to
+   * `ListGlossaries` method to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/LocationName.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/LocationName.java new file mode 100644 index 00000000..3d230c3d --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/LocationName.java @@ -0,0 +1,182 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.translate.v3; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class LocationName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String location; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + + public static LocationName of(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static LocationName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "LocationName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (LocationName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("location", location); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project, "location", location); + } + + /** Builder for LocationName. */ + public static class Builder { + + private String project; + private String location; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder() {} + + private Builder(LocationName locationName) { + project = locationName.project; + location = locationName.location; + } + + public LocationName build() { + return new LocationName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof LocationName) { + LocationName that = (LocationName) o; + return (this.project.equals(that.project)) && (this.location.equals(that.location)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= location.hashCode(); + return h; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/OutputConfig.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/OutputConfig.java new file mode 100644 index 00000000..6d5eaaa7 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/OutputConfig.java @@ -0,0 +1,1456 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Output configuration for BatchTranslateText request.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.OutputConfig} + */ +public final class OutputConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.OutputConfig) + OutputConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use OutputConfig.newBuilder() to construct. + private OutputConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private OutputConfig() {} + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private OutputConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.translate.v3.GcsDestination.Builder subBuilder = null; + if (destinationCase_ == 1) { + subBuilder = + ((com.google.cloud.translate.v3.GcsDestination) destination_).toBuilder(); + } + destination_ = + input.readMessage( + com.google.cloud.translate.v3.GcsDestination.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.translate.v3.GcsDestination) destination_); + destination_ = subBuilder.buildPartial(); + } + destinationCase_ = 1; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_OutputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_OutputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.OutputConfig.class, + com.google.cloud.translate.v3.OutputConfig.Builder.class); + } + + private int destinationCase_ = 0; + private java.lang.Object destination_; + + public enum DestinationCase implements com.google.protobuf.Internal.EnumLite { + GCS_DESTINATION(1), + DESTINATION_NOT_SET(0); + private final int value; + + private DestinationCase(int value) { + this.value = value; + } + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static DestinationCase valueOf(int value) { + return forNumber(value); + } + + public static DestinationCase forNumber(int value) { + switch (value) { + case 1: + return GCS_DESTINATION; + case 0: + return DESTINATION_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public DestinationCase getDestinationCase() { + return DestinationCase.forNumber(destinationCase_); + } + + public static final int GCS_DESTINATION_FIELD_NUMBER = 1; + /** + * + * + *
+   * Google Cloud Storage destination for output content.
+   * For every single input file (for example, gs://a/b/c.[extension]), we
+   * generate at most 2 * n output files. (n is the # of target_language_codes
+   * in the BatchTranslateTextRequest).
+   * Output files (tsv) generated are compliant with RFC 4180 except that
+   * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+   * change record delimiters.
+   * While the input files are being processed, we write/update an index file
+   * 'index.csv'  under 'output_uri_prefix' (for example,
+   * gs://translation-test/index.csv) The index file is generated/updated as
+   * new files are being translated. The format is:
+   * input_file,target_language_code,translations_file,errors_file,
+   * glossary_translations_file,glossary_errors_file
+   * input_file is one file we matched using gcs_source.input_uri.
+   * target_language_code is provided in the request.
+   * translations_file contains the translations. (details provided below)
+   * errors_file contains the errors during processing of the file. (details
+   * below). Both translations_file and errors_file could be empty
+   * strings if we have no content to output.
+   * glossary_translations_file and glossary_errors_file are always empty
+   * strings if the input_file is tsv. They could also be empty if we have no
+   * content to output.
+   * Once a row is present in index.csv, the input/output matching never
+   * changes. Callers should also expect all the content in input_file are
+   * processed and ready to be consumed (that is, no partial output file is
+   * written).
+   * The format of translations_file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_translations.[extension]
+   * If the input file extension is tsv, the output has the following
+   * columns:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: translation without applying a glossary. Empty string if there
+   * is an error.
+   * Column 4 (only present if a glossary is provided in the request):
+   * translation after applying the glossary. Empty string if there is an
+   * error applying the glossary. Could be same string as column 3 if there is
+   * no glossary applied.
+   * If input file extension is a txt or html, the translation is directly
+   * written to the output file. If glossary is requested, a separate
+   * glossary_translations_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+   * The format of errors file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_errors.[extension]
+   * If the input file extension is tsv, errors_file contains the following:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: Error detail for the translation. Could be empty.
+   * Column 4 (only present if a glossary is provided in the request):
+   * Error when applying the glossary.
+   * If the input file extension is txt or html, glossary_error_file will be
+   * generated that contains error details. glossary_error_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+   * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public boolean hasGcsDestination() { + return destinationCase_ == 1; + } + /** + * + * + *
+   * Google Cloud Storage destination for output content.
+   * For every single input file (for example, gs://a/b/c.[extension]), we
+   * generate at most 2 * n output files. (n is the # of target_language_codes
+   * in the BatchTranslateTextRequest).
+   * Output files (tsv) generated are compliant with RFC 4180 except that
+   * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+   * change record delimiters.
+   * While the input files are being processed, we write/update an index file
+   * 'index.csv'  under 'output_uri_prefix' (for example,
+   * gs://translation-test/index.csv) The index file is generated/updated as
+   * new files are being translated. The format is:
+   * input_file,target_language_code,translations_file,errors_file,
+   * glossary_translations_file,glossary_errors_file
+   * input_file is one file we matched using gcs_source.input_uri.
+   * target_language_code is provided in the request.
+   * translations_file contains the translations. (details provided below)
+   * errors_file contains the errors during processing of the file. (details
+   * below). Both translations_file and errors_file could be empty
+   * strings if we have no content to output.
+   * glossary_translations_file and glossary_errors_file are always empty
+   * strings if the input_file is tsv. They could also be empty if we have no
+   * content to output.
+   * Once a row is present in index.csv, the input/output matching never
+   * changes. Callers should also expect all the content in input_file are
+   * processed and ready to be consumed (that is, no partial output file is
+   * written).
+   * The format of translations_file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_translations.[extension]
+   * If the input file extension is tsv, the output has the following
+   * columns:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: translation without applying a glossary. Empty string if there
+   * is an error.
+   * Column 4 (only present if a glossary is provided in the request):
+   * translation after applying the glossary. Empty string if there is an
+   * error applying the glossary. Could be same string as column 3 if there is
+   * no glossary applied.
+   * If input file extension is a txt or html, the translation is directly
+   * written to the output file. If glossary is requested, a separate
+   * glossary_translations_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+   * The format of errors file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_errors.[extension]
+   * If the input file extension is tsv, errors_file contains the following:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: Error detail for the translation. Could be empty.
+   * Column 4 (only present if a glossary is provided in the request):
+   * Error when applying the glossary.
+   * If the input file extension is txt or html, glossary_error_file will be
+   * generated that contains error details. glossary_error_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+   * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public com.google.cloud.translate.v3.GcsDestination getGcsDestination() { + if (destinationCase_ == 1) { + return (com.google.cloud.translate.v3.GcsDestination) destination_; + } + return com.google.cloud.translate.v3.GcsDestination.getDefaultInstance(); + } + /** + * + * + *
+   * Google Cloud Storage destination for output content.
+   * For every single input file (for example, gs://a/b/c.[extension]), we
+   * generate at most 2 * n output files. (n is the # of target_language_codes
+   * in the BatchTranslateTextRequest).
+   * Output files (tsv) generated are compliant with RFC 4180 except that
+   * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+   * change record delimiters.
+   * While the input files are being processed, we write/update an index file
+   * 'index.csv'  under 'output_uri_prefix' (for example,
+   * gs://translation-test/index.csv) The index file is generated/updated as
+   * new files are being translated. The format is:
+   * input_file,target_language_code,translations_file,errors_file,
+   * glossary_translations_file,glossary_errors_file
+   * input_file is one file we matched using gcs_source.input_uri.
+   * target_language_code is provided in the request.
+   * translations_file contains the translations. (details provided below)
+   * errors_file contains the errors during processing of the file. (details
+   * below). Both translations_file and errors_file could be empty
+   * strings if we have no content to output.
+   * glossary_translations_file and glossary_errors_file are always empty
+   * strings if the input_file is tsv. They could also be empty if we have no
+   * content to output.
+   * Once a row is present in index.csv, the input/output matching never
+   * changes. Callers should also expect all the content in input_file are
+   * processed and ready to be consumed (that is, no partial output file is
+   * written).
+   * The format of translations_file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_translations.[extension]
+   * If the input file extension is tsv, the output has the following
+   * columns:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: translation without applying a glossary. Empty string if there
+   * is an error.
+   * Column 4 (only present if a glossary is provided in the request):
+   * translation after applying the glossary. Empty string if there is an
+   * error applying the glossary. Could be same string as column 3 if there is
+   * no glossary applied.
+   * If input file extension is a txt or html, the translation is directly
+   * written to the output file. If glossary is requested, a separate
+   * glossary_translations_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+   * The format of errors file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_errors.[extension]
+   * If the input file extension is tsv, errors_file contains the following:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: Error detail for the translation. Could be empty.
+   * Column 4 (only present if a glossary is provided in the request):
+   * Error when applying the glossary.
+   * If the input file extension is txt or html, glossary_error_file will be
+   * generated that contains error details. glossary_error_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+   * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public com.google.cloud.translate.v3.GcsDestinationOrBuilder getGcsDestinationOrBuilder() { + if (destinationCase_ == 1) { + return (com.google.cloud.translate.v3.GcsDestination) destination_; + } + return com.google.cloud.translate.v3.GcsDestination.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (destinationCase_ == 1) { + output.writeMessage(1, (com.google.cloud.translate.v3.GcsDestination) destination_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (destinationCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.cloud.translate.v3.GcsDestination) destination_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.OutputConfig)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.OutputConfig other = + (com.google.cloud.translate.v3.OutputConfig) obj; + + if (!getDestinationCase().equals(other.getDestinationCase())) return false; + switch (destinationCase_) { + case 1: + if (!getGcsDestination().equals(other.getGcsDestination())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (destinationCase_) { + case 1: + hash = (37 * hash) + GCS_DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getGcsDestination().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.OutputConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.OutputConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.OutputConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.OutputConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Output configuration for BatchTranslateText request.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.OutputConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.OutputConfig) + com.google.cloud.translate.v3.OutputConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_OutputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_OutputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.OutputConfig.class, + com.google.cloud.translate.v3.OutputConfig.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.OutputConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + destinationCase_ = 0; + destination_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_OutputConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.OutputConfig getDefaultInstanceForType() { + return com.google.cloud.translate.v3.OutputConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.OutputConfig build() { + com.google.cloud.translate.v3.OutputConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.OutputConfig buildPartial() { + com.google.cloud.translate.v3.OutputConfig result = + new com.google.cloud.translate.v3.OutputConfig(this); + if (destinationCase_ == 1) { + if (gcsDestinationBuilder_ == null) { + result.destination_ = destination_; + } else { + result.destination_ = gcsDestinationBuilder_.build(); + } + } + result.destinationCase_ = destinationCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.OutputConfig) { + return mergeFrom((com.google.cloud.translate.v3.OutputConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.OutputConfig other) { + if (other == com.google.cloud.translate.v3.OutputConfig.getDefaultInstance()) return this; + switch (other.getDestinationCase()) { + case GCS_DESTINATION: + { + mergeGcsDestination(other.getGcsDestination()); + break; + } + case DESTINATION_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.OutputConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.OutputConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int destinationCase_ = 0; + private java.lang.Object destination_; + + public DestinationCase getDestinationCase() { + return DestinationCase.forNumber(destinationCase_); + } + + public Builder clearDestination() { + destinationCase_ = 0; + destination_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsDestination, + com.google.cloud.translate.v3.GcsDestination.Builder, + com.google.cloud.translate.v3.GcsDestinationOrBuilder> + gcsDestinationBuilder_; + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public boolean hasGcsDestination() { + return destinationCase_ == 1; + } + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public com.google.cloud.translate.v3.GcsDestination getGcsDestination() { + if (gcsDestinationBuilder_ == null) { + if (destinationCase_ == 1) { + return (com.google.cloud.translate.v3.GcsDestination) destination_; + } + return com.google.cloud.translate.v3.GcsDestination.getDefaultInstance(); + } else { + if (destinationCase_ == 1) { + return gcsDestinationBuilder_.getMessage(); + } + return com.google.cloud.translate.v3.GcsDestination.getDefaultInstance(); + } + } + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public Builder setGcsDestination(com.google.cloud.translate.v3.GcsDestination value) { + if (gcsDestinationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + destination_ = value; + onChanged(); + } else { + gcsDestinationBuilder_.setMessage(value); + } + destinationCase_ = 1; + return this; + } + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public Builder setGcsDestination( + com.google.cloud.translate.v3.GcsDestination.Builder builderForValue) { + if (gcsDestinationBuilder_ == null) { + destination_ = builderForValue.build(); + onChanged(); + } else { + gcsDestinationBuilder_.setMessage(builderForValue.build()); + } + destinationCase_ = 1; + return this; + } + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public Builder mergeGcsDestination(com.google.cloud.translate.v3.GcsDestination value) { + if (gcsDestinationBuilder_ == null) { + if (destinationCase_ == 1 + && destination_ != com.google.cloud.translate.v3.GcsDestination.getDefaultInstance()) { + destination_ = + com.google.cloud.translate.v3.GcsDestination.newBuilder( + (com.google.cloud.translate.v3.GcsDestination) destination_) + .mergeFrom(value) + .buildPartial(); + } else { + destination_ = value; + } + onChanged(); + } else { + if (destinationCase_ == 1) { + gcsDestinationBuilder_.mergeFrom(value); + } + gcsDestinationBuilder_.setMessage(value); + } + destinationCase_ = 1; + return this; + } + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public Builder clearGcsDestination() { + if (gcsDestinationBuilder_ == null) { + if (destinationCase_ == 1) { + destinationCase_ = 0; + destination_ = null; + onChanged(); + } + } else { + if (destinationCase_ == 1) { + destinationCase_ = 0; + destination_ = null; + } + gcsDestinationBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public com.google.cloud.translate.v3.GcsDestination.Builder getGcsDestinationBuilder() { + return getGcsDestinationFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + public com.google.cloud.translate.v3.GcsDestinationOrBuilder getGcsDestinationOrBuilder() { + if ((destinationCase_ == 1) && (gcsDestinationBuilder_ != null)) { + return gcsDestinationBuilder_.getMessageOrBuilder(); + } else { + if (destinationCase_ == 1) { + return (com.google.cloud.translate.v3.GcsDestination) destination_; + } + return com.google.cloud.translate.v3.GcsDestination.getDefaultInstance(); + } + } + /** + * + * + *
+     * Google Cloud Storage destination for output content.
+     * For every single input file (for example, gs://a/b/c.[extension]), we
+     * generate at most 2 * n output files. (n is the # of target_language_codes
+     * in the BatchTranslateTextRequest).
+     * Output files (tsv) generated are compliant with RFC 4180 except that
+     * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+     * change record delimiters.
+     * While the input files are being processed, we write/update an index file
+     * 'index.csv'  under 'output_uri_prefix' (for example,
+     * gs://translation-test/index.csv) The index file is generated/updated as
+     * new files are being translated. The format is:
+     * input_file,target_language_code,translations_file,errors_file,
+     * glossary_translations_file,glossary_errors_file
+     * input_file is one file we matched using gcs_source.input_uri.
+     * target_language_code is provided in the request.
+     * translations_file contains the translations. (details provided below)
+     * errors_file contains the errors during processing of the file. (details
+     * below). Both translations_file and errors_file could be empty
+     * strings if we have no content to output.
+     * glossary_translations_file and glossary_errors_file are always empty
+     * strings if the input_file is tsv. They could also be empty if we have no
+     * content to output.
+     * Once a row is present in index.csv, the input/output matching never
+     * changes. Callers should also expect all the content in input_file are
+     * processed and ready to be consumed (that is, no partial output file is
+     * written).
+     * The format of translations_file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_translations.[extension]
+     * If the input file extension is tsv, the output has the following
+     * columns:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: translation without applying a glossary. Empty string if there
+     * is an error.
+     * Column 4 (only present if a glossary is provided in the request):
+     * translation after applying the glossary. Empty string if there is an
+     * error applying the glossary. Could be same string as column 3 if there is
+     * no glossary applied.
+     * If input file extension is a txt or html, the translation is directly
+     * written to the output file. If glossary is requested, a separate
+     * glossary_translations_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+     * The format of errors file (for target language code 'trg') is:
+     * gs://translation_test/a_b_c_'trg'_errors.[extension]
+     * If the input file extension is tsv, errors_file contains the following:
+     * Column 1: ID of the request provided in the input, if it's not
+     * provided in the input, then the input row number is used (0-based).
+     * Column 2: source sentence.
+     * Column 3: Error detail for the translation. Could be empty.
+     * Column 4 (only present if a glossary is provided in the request):
+     * Error when applying the glossary.
+     * If the input file extension is txt or html, glossary_error_file will be
+     * generated that contains error details. glossary_error_file has format of
+     * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+     * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsDestination, + com.google.cloud.translate.v3.GcsDestination.Builder, + com.google.cloud.translate.v3.GcsDestinationOrBuilder> + getGcsDestinationFieldBuilder() { + if (gcsDestinationBuilder_ == null) { + if (!(destinationCase_ == 1)) { + destination_ = com.google.cloud.translate.v3.GcsDestination.getDefaultInstance(); + } + gcsDestinationBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.GcsDestination, + com.google.cloud.translate.v3.GcsDestination.Builder, + com.google.cloud.translate.v3.GcsDestinationOrBuilder>( + (com.google.cloud.translate.v3.GcsDestination) destination_, + getParentForChildren(), + isClean()); + destination_ = null; + } + destinationCase_ = 1; + onChanged(); + ; + return gcsDestinationBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.OutputConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.OutputConfig) + private static final com.google.cloud.translate.v3.OutputConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.OutputConfig(); + } + + public static com.google.cloud.translate.v3.OutputConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OutputConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OutputConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.OutputConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/OutputConfigOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/OutputConfigOrBuilder.java new file mode 100644 index 00000000..03d9e528 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/OutputConfigOrBuilder.java @@ -0,0 +1,220 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface OutputConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.OutputConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Google Cloud Storage destination for output content.
+   * For every single input file (for example, gs://a/b/c.[extension]), we
+   * generate at most 2 * n output files. (n is the # of target_language_codes
+   * in the BatchTranslateTextRequest).
+   * Output files (tsv) generated are compliant with RFC 4180 except that
+   * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+   * change record delimiters.
+   * While the input files are being processed, we write/update an index file
+   * 'index.csv'  under 'output_uri_prefix' (for example,
+   * gs://translation-test/index.csv) The index file is generated/updated as
+   * new files are being translated. The format is:
+   * input_file,target_language_code,translations_file,errors_file,
+   * glossary_translations_file,glossary_errors_file
+   * input_file is one file we matched using gcs_source.input_uri.
+   * target_language_code is provided in the request.
+   * translations_file contains the translations. (details provided below)
+   * errors_file contains the errors during processing of the file. (details
+   * below). Both translations_file and errors_file could be empty
+   * strings if we have no content to output.
+   * glossary_translations_file and glossary_errors_file are always empty
+   * strings if the input_file is tsv. They could also be empty if we have no
+   * content to output.
+   * Once a row is present in index.csv, the input/output matching never
+   * changes. Callers should also expect all the content in input_file are
+   * processed and ready to be consumed (that is, no partial output file is
+   * written).
+   * The format of translations_file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_translations.[extension]
+   * If the input file extension is tsv, the output has the following
+   * columns:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: translation without applying a glossary. Empty string if there
+   * is an error.
+   * Column 4 (only present if a glossary is provided in the request):
+   * translation after applying the glossary. Empty string if there is an
+   * error applying the glossary. Could be same string as column 3 if there is
+   * no glossary applied.
+   * If input file extension is a txt or html, the translation is directly
+   * written to the output file. If glossary is requested, a separate
+   * glossary_translations_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+   * The format of errors file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_errors.[extension]
+   * If the input file extension is tsv, errors_file contains the following:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: Error detail for the translation. Could be empty.
+   * Column 4 (only present if a glossary is provided in the request):
+   * Error when applying the glossary.
+   * If the input file extension is txt or html, glossary_error_file will be
+   * generated that contains error details. glossary_error_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+   * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + boolean hasGcsDestination(); + /** + * + * + *
+   * Google Cloud Storage destination for output content.
+   * For every single input file (for example, gs://a/b/c.[extension]), we
+   * generate at most 2 * n output files. (n is the # of target_language_codes
+   * in the BatchTranslateTextRequest).
+   * Output files (tsv) generated are compliant with RFC 4180 except that
+   * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+   * change record delimiters.
+   * While the input files are being processed, we write/update an index file
+   * 'index.csv'  under 'output_uri_prefix' (for example,
+   * gs://translation-test/index.csv) The index file is generated/updated as
+   * new files are being translated. The format is:
+   * input_file,target_language_code,translations_file,errors_file,
+   * glossary_translations_file,glossary_errors_file
+   * input_file is one file we matched using gcs_source.input_uri.
+   * target_language_code is provided in the request.
+   * translations_file contains the translations. (details provided below)
+   * errors_file contains the errors during processing of the file. (details
+   * below). Both translations_file and errors_file could be empty
+   * strings if we have no content to output.
+   * glossary_translations_file and glossary_errors_file are always empty
+   * strings if the input_file is tsv. They could also be empty if we have no
+   * content to output.
+   * Once a row is present in index.csv, the input/output matching never
+   * changes. Callers should also expect all the content in input_file are
+   * processed and ready to be consumed (that is, no partial output file is
+   * written).
+   * The format of translations_file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_translations.[extension]
+   * If the input file extension is tsv, the output has the following
+   * columns:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: translation without applying a glossary. Empty string if there
+   * is an error.
+   * Column 4 (only present if a glossary is provided in the request):
+   * translation after applying the glossary. Empty string if there is an
+   * error applying the glossary. Could be same string as column 3 if there is
+   * no glossary applied.
+   * If input file extension is a txt or html, the translation is directly
+   * written to the output file. If glossary is requested, a separate
+   * glossary_translations_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+   * The format of errors file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_errors.[extension]
+   * If the input file extension is tsv, errors_file contains the following:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: Error detail for the translation. Could be empty.
+   * Column 4 (only present if a glossary is provided in the request):
+   * Error when applying the glossary.
+   * If the input file extension is txt or html, glossary_error_file will be
+   * generated that contains error details. glossary_error_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+   * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + com.google.cloud.translate.v3.GcsDestination getGcsDestination(); + /** + * + * + *
+   * Google Cloud Storage destination for output content.
+   * For every single input file (for example, gs://a/b/c.[extension]), we
+   * generate at most 2 * n output files. (n is the # of target_language_codes
+   * in the BatchTranslateTextRequest).
+   * Output files (tsv) generated are compliant with RFC 4180 except that
+   * record delimiters are '\n' instead of '\r\n'. We don't provide any way to
+   * change record delimiters.
+   * While the input files are being processed, we write/update an index file
+   * 'index.csv'  under 'output_uri_prefix' (for example,
+   * gs://translation-test/index.csv) The index file is generated/updated as
+   * new files are being translated. The format is:
+   * input_file,target_language_code,translations_file,errors_file,
+   * glossary_translations_file,glossary_errors_file
+   * input_file is one file we matched using gcs_source.input_uri.
+   * target_language_code is provided in the request.
+   * translations_file contains the translations. (details provided below)
+   * errors_file contains the errors during processing of the file. (details
+   * below). Both translations_file and errors_file could be empty
+   * strings if we have no content to output.
+   * glossary_translations_file and glossary_errors_file are always empty
+   * strings if the input_file is tsv. They could also be empty if we have no
+   * content to output.
+   * Once a row is present in index.csv, the input/output matching never
+   * changes. Callers should also expect all the content in input_file are
+   * processed and ready to be consumed (that is, no partial output file is
+   * written).
+   * The format of translations_file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_translations.[extension]
+   * If the input file extension is tsv, the output has the following
+   * columns:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: translation without applying a glossary. Empty string if there
+   * is an error.
+   * Column 4 (only present if a glossary is provided in the request):
+   * translation after applying the glossary. Empty string if there is an
+   * error applying the glossary. Could be same string as column 3 if there is
+   * no glossary applied.
+   * If input file extension is a txt or html, the translation is directly
+   * written to the output file. If glossary is requested, a separate
+   * glossary_translations_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]
+   * The format of errors file (for target language code 'trg') is:
+   * gs://translation_test/a_b_c_'trg'_errors.[extension]
+   * If the input file extension is tsv, errors_file contains the following:
+   * Column 1: ID of the request provided in the input, if it's not
+   * provided in the input, then the input row number is used (0-based).
+   * Column 2: source sentence.
+   * Column 3: Error detail for the translation. Could be empty.
+   * Column 4 (only present if a glossary is provided in the request):
+   * Error when applying the glossary.
+   * If the input file extension is txt or html, glossary_error_file will be
+   * generated that contains error details. glossary_error_file has format of
+   * gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]
+   * 
+ * + * .google.cloud.translation.v3.GcsDestination gcs_destination = 1; + */ + com.google.cloud.translate.v3.GcsDestinationOrBuilder getGcsDestinationOrBuilder(); + + public com.google.cloud.translate.v3.OutputConfig.DestinationCase getDestinationCase(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguage.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguage.java new file mode 100644 index 00000000..26281497 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguage.java @@ -0,0 +1,961 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * A single supported language response corresponds to information related
+ * to one supported language.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.SupportedLanguage} + */ +public final class SupportedLanguage extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.SupportedLanguage) + SupportedLanguageOrBuilder { + private static final long serialVersionUID = 0L; + // Use SupportedLanguage.newBuilder() to construct. + private SupportedLanguage(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SupportedLanguage() { + languageCode_ = ""; + displayName_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SupportedLanguage( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + languageCode_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 24: + { + supportSource_ = input.readBool(); + break; + } + case 32: + { + supportTarget_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguage_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.SupportedLanguage.class, + com.google.cloud.translate.v3.SupportedLanguage.Builder.class); + } + + public static final int LANGUAGE_CODE_FIELD_NUMBER = 1; + private volatile java.lang.Object languageCode_; + /** + * + * + *
+   * Supported language code, generally consisting of its ISO 639-1
+   * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+   * including language and region identifiers are returned (for example,
+   * 'zh-TW' and 'zh-CN')
+   * 
+ * + * string language_code = 1; + */ + public java.lang.String getLanguageCode() { + java.lang.Object ref = languageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageCode_ = s; + return s; + } + } + /** + * + * + *
+   * Supported language code, generally consisting of its ISO 639-1
+   * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+   * including language and region identifiers are returned (for example,
+   * 'zh-TW' and 'zh-CN')
+   * 
+ * + * string language_code = 1; + */ + public com.google.protobuf.ByteString getLanguageCodeBytes() { + java.lang.Object ref = languageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * Human readable name of the language localized in the display language
+   * specified in the request.
+   * 
+ * + * string display_name = 2; + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * Human readable name of the language localized in the display language
+   * specified in the request.
+   * 
+ * + * string display_name = 2; + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SUPPORT_SOURCE_FIELD_NUMBER = 3; + private boolean supportSource_; + /** + * + * + *
+   * Can be used as source language.
+   * 
+ * + * bool support_source = 3; + */ + public boolean getSupportSource() { + return supportSource_; + } + + public static final int SUPPORT_TARGET_FIELD_NUMBER = 4; + private boolean supportTarget_; + /** + * + * + *
+   * Can be used as target language.
+   * 
+ * + * bool support_target = 4; + */ + public boolean getSupportTarget() { + return supportTarget_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, languageCode_); + } + if (!getDisplayNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_); + } + if (supportSource_ != false) { + output.writeBool(3, supportSource_); + } + if (supportTarget_ != false) { + output.writeBool(4, supportTarget_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, languageCode_); + } + if (!getDisplayNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_); + } + if (supportSource_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, supportSource_); + } + if (supportTarget_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, supportTarget_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.SupportedLanguage)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.SupportedLanguage other = + (com.google.cloud.translate.v3.SupportedLanguage) obj; + + if (!getLanguageCode().equals(other.getLanguageCode())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (getSupportSource() != other.getSupportSource()) return false; + if (getSupportTarget() != other.getSupportTarget()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getLanguageCode().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + SUPPORT_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getSupportSource()); + hash = (37 * hash) + SUPPORT_TARGET_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getSupportTarget()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.SupportedLanguage parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.SupportedLanguage prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A single supported language response corresponds to information related
+   * to one supported language.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.SupportedLanguage} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.SupportedLanguage) + com.google.cloud.translate.v3.SupportedLanguageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguage_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguage_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.SupportedLanguage.class, + com.google.cloud.translate.v3.SupportedLanguage.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.SupportedLanguage.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + languageCode_ = ""; + + displayName_ = ""; + + supportSource_ = false; + + supportTarget_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguage_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.SupportedLanguage getDefaultInstanceForType() { + return com.google.cloud.translate.v3.SupportedLanguage.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.SupportedLanguage build() { + com.google.cloud.translate.v3.SupportedLanguage result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.SupportedLanguage buildPartial() { + com.google.cloud.translate.v3.SupportedLanguage result = + new com.google.cloud.translate.v3.SupportedLanguage(this); + result.languageCode_ = languageCode_; + result.displayName_ = displayName_; + result.supportSource_ = supportSource_; + result.supportTarget_ = supportTarget_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.SupportedLanguage) { + return mergeFrom((com.google.cloud.translate.v3.SupportedLanguage) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.SupportedLanguage other) { + if (other == com.google.cloud.translate.v3.SupportedLanguage.getDefaultInstance()) + return this; + if (!other.getLanguageCode().isEmpty()) { + languageCode_ = other.languageCode_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (other.getSupportSource() != false) { + setSupportSource(other.getSupportSource()); + } + if (other.getSupportTarget() != false) { + setSupportTarget(other.getSupportTarget()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.SupportedLanguage parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.SupportedLanguage) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object languageCode_ = ""; + /** + * + * + *
+     * Supported language code, generally consisting of its ISO 639-1
+     * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+     * including language and region identifiers are returned (for example,
+     * 'zh-TW' and 'zh-CN')
+     * 
+ * + * string language_code = 1; + */ + public java.lang.String getLanguageCode() { + java.lang.Object ref = languageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Supported language code, generally consisting of its ISO 639-1
+     * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+     * including language and region identifiers are returned (for example,
+     * 'zh-TW' and 'zh-CN')
+     * 
+ * + * string language_code = 1; + */ + public com.google.protobuf.ByteString getLanguageCodeBytes() { + java.lang.Object ref = languageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Supported language code, generally consisting of its ISO 639-1
+     * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+     * including language and region identifiers are returned (for example,
+     * 'zh-TW' and 'zh-CN')
+     * 
+ * + * string language_code = 1; + */ + public Builder setLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + languageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Supported language code, generally consisting of its ISO 639-1
+     * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+     * including language and region identifiers are returned (for example,
+     * 'zh-TW' and 'zh-CN')
+     * 
+ * + * string language_code = 1; + */ + public Builder clearLanguageCode() { + + languageCode_ = getDefaultInstance().getLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * Supported language code, generally consisting of its ISO 639-1
+     * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+     * including language and region identifiers are returned (for example,
+     * 'zh-TW' and 'zh-CN')
+     * 
+ * + * string language_code = 1; + */ + public Builder setLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + languageCode_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * Human readable name of the language localized in the display language
+     * specified in the request.
+     * 
+ * + * string display_name = 2; + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Human readable name of the language localized in the display language
+     * specified in the request.
+     * 
+ * + * string display_name = 2; + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Human readable name of the language localized in the display language
+     * specified in the request.
+     * 
+ * + * string display_name = 2; + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Human readable name of the language localized in the display language
+     * specified in the request.
+     * 
+ * + * string display_name = 2; + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Human readable name of the language localized in the display language
+     * specified in the request.
+     * 
+ * + * string display_name = 2; + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private boolean supportSource_; + /** + * + * + *
+     * Can be used as source language.
+     * 
+ * + * bool support_source = 3; + */ + public boolean getSupportSource() { + return supportSource_; + } + /** + * + * + *
+     * Can be used as source language.
+     * 
+ * + * bool support_source = 3; + */ + public Builder setSupportSource(boolean value) { + + supportSource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Can be used as source language.
+     * 
+ * + * bool support_source = 3; + */ + public Builder clearSupportSource() { + + supportSource_ = false; + onChanged(); + return this; + } + + private boolean supportTarget_; + /** + * + * + *
+     * Can be used as target language.
+     * 
+ * + * bool support_target = 4; + */ + public boolean getSupportTarget() { + return supportTarget_; + } + /** + * + * + *
+     * Can be used as target language.
+     * 
+ * + * bool support_target = 4; + */ + public Builder setSupportTarget(boolean value) { + + supportTarget_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Can be used as target language.
+     * 
+ * + * bool support_target = 4; + */ + public Builder clearSupportTarget() { + + supportTarget_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.SupportedLanguage) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.SupportedLanguage) + private static final com.google.cloud.translate.v3.SupportedLanguage DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.SupportedLanguage(); + } + + public static com.google.cloud.translate.v3.SupportedLanguage getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SupportedLanguage parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SupportedLanguage(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.SupportedLanguage getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguageOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguageOrBuilder.java new file mode 100644 index 00000000..dac15606 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguageOrBuilder.java @@ -0,0 +1,97 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface SupportedLanguageOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.SupportedLanguage) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Supported language code, generally consisting of its ISO 639-1
+   * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+   * including language and region identifiers are returned (for example,
+   * 'zh-TW' and 'zh-CN')
+   * 
+ * + * string language_code = 1; + */ + java.lang.String getLanguageCode(); + /** + * + * + *
+   * Supported language code, generally consisting of its ISO 639-1
+   * identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes
+   * including language and region identifiers are returned (for example,
+   * 'zh-TW' and 'zh-CN')
+   * 
+ * + * string language_code = 1; + */ + com.google.protobuf.ByteString getLanguageCodeBytes(); + + /** + * + * + *
+   * Human readable name of the language localized in the display language
+   * specified in the request.
+   * 
+ * + * string display_name = 2; + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * Human readable name of the language localized in the display language
+   * specified in the request.
+   * 
+ * + * string display_name = 2; + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Can be used as source language.
+   * 
+ * + * bool support_source = 3; + */ + boolean getSupportSource(); + + /** + * + * + *
+   * Can be used as target language.
+   * 
+ * + * bool support_target = 4; + */ + boolean getSupportTarget(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguages.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguages.java new file mode 100644 index 00000000..f282275a --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguages.java @@ -0,0 +1,964 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The response message for discovering supported languages.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.SupportedLanguages} + */ +public final class SupportedLanguages extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.SupportedLanguages) + SupportedLanguagesOrBuilder { + private static final long serialVersionUID = 0L; + // Use SupportedLanguages.newBuilder() to construct. + private SupportedLanguages(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SupportedLanguages() { + languages_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SupportedLanguages( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + languages_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + languages_.add( + input.readMessage( + com.google.cloud.translate.v3.SupportedLanguage.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + languages_ = java.util.Collections.unmodifiableList(languages_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguages_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguages_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.SupportedLanguages.class, + com.google.cloud.translate.v3.SupportedLanguages.Builder.class); + } + + public static final int LANGUAGES_FIELD_NUMBER = 1; + private java.util.List languages_; + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public java.util.List getLanguagesList() { + return languages_; + } + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public java.util.List + getLanguagesOrBuilderList() { + return languages_; + } + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public int getLanguagesCount() { + return languages_.size(); + } + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.SupportedLanguage getLanguages(int index) { + return languages_.get(index); + } + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.SupportedLanguageOrBuilder getLanguagesOrBuilder(int index) { + return languages_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < languages_.size(); i++) { + output.writeMessage(1, languages_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < languages_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, languages_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.SupportedLanguages)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.SupportedLanguages other = + (com.google.cloud.translate.v3.SupportedLanguages) obj; + + if (!getLanguagesList().equals(other.getLanguagesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getLanguagesCount() > 0) { + hash = (37 * hash) + LANGUAGES_FIELD_NUMBER; + hash = (53 * hash) + getLanguagesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.SupportedLanguages parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.SupportedLanguages prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The response message for discovering supported languages.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.SupportedLanguages} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.SupportedLanguages) + com.google.cloud.translate.v3.SupportedLanguagesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguages_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguages_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.SupportedLanguages.class, + com.google.cloud.translate.v3.SupportedLanguages.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.SupportedLanguages.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getLanguagesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (languagesBuilder_ == null) { + languages_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + languagesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_SupportedLanguages_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.SupportedLanguages getDefaultInstanceForType() { + return com.google.cloud.translate.v3.SupportedLanguages.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.SupportedLanguages build() { + com.google.cloud.translate.v3.SupportedLanguages result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.SupportedLanguages buildPartial() { + com.google.cloud.translate.v3.SupportedLanguages result = + new com.google.cloud.translate.v3.SupportedLanguages(this); + int from_bitField0_ = bitField0_; + if (languagesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + languages_ = java.util.Collections.unmodifiableList(languages_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.languages_ = languages_; + } else { + result.languages_ = languagesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.SupportedLanguages) { + return mergeFrom((com.google.cloud.translate.v3.SupportedLanguages) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.SupportedLanguages other) { + if (other == com.google.cloud.translate.v3.SupportedLanguages.getDefaultInstance()) + return this; + if (languagesBuilder_ == null) { + if (!other.languages_.isEmpty()) { + if (languages_.isEmpty()) { + languages_ = other.languages_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureLanguagesIsMutable(); + languages_.addAll(other.languages_); + } + onChanged(); + } + } else { + if (!other.languages_.isEmpty()) { + if (languagesBuilder_.isEmpty()) { + languagesBuilder_.dispose(); + languagesBuilder_ = null; + languages_ = other.languages_; + bitField0_ = (bitField0_ & ~0x00000001); + languagesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getLanguagesFieldBuilder() + : null; + } else { + languagesBuilder_.addAllMessages(other.languages_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.SupportedLanguages parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.SupportedLanguages) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List languages_ = + java.util.Collections.emptyList(); + + private void ensureLanguagesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + languages_ = + new java.util.ArrayList(languages_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.SupportedLanguage, + com.google.cloud.translate.v3.SupportedLanguage.Builder, + com.google.cloud.translate.v3.SupportedLanguageOrBuilder> + languagesBuilder_; + + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public java.util.List getLanguagesList() { + if (languagesBuilder_ == null) { + return java.util.Collections.unmodifiableList(languages_); + } else { + return languagesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public int getLanguagesCount() { + if (languagesBuilder_ == null) { + return languages_.size(); + } else { + return languagesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.SupportedLanguage getLanguages(int index) { + if (languagesBuilder_ == null) { + return languages_.get(index); + } else { + return languagesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder setLanguages(int index, com.google.cloud.translate.v3.SupportedLanguage value) { + if (languagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguagesIsMutable(); + languages_.set(index, value); + onChanged(); + } else { + languagesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder setLanguages( + int index, com.google.cloud.translate.v3.SupportedLanguage.Builder builderForValue) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + languages_.set(index, builderForValue.build()); + onChanged(); + } else { + languagesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder addLanguages(com.google.cloud.translate.v3.SupportedLanguage value) { + if (languagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguagesIsMutable(); + languages_.add(value); + onChanged(); + } else { + languagesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder addLanguages(int index, com.google.cloud.translate.v3.SupportedLanguage value) { + if (languagesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLanguagesIsMutable(); + languages_.add(index, value); + onChanged(); + } else { + languagesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder addLanguages( + com.google.cloud.translate.v3.SupportedLanguage.Builder builderForValue) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + languages_.add(builderForValue.build()); + onChanged(); + } else { + languagesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder addLanguages( + int index, com.google.cloud.translate.v3.SupportedLanguage.Builder builderForValue) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + languages_.add(index, builderForValue.build()); + onChanged(); + } else { + languagesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder addAllLanguages( + java.lang.Iterable values) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, languages_); + onChanged(); + } else { + languagesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder clearLanguages() { + if (languagesBuilder_ == null) { + languages_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + languagesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public Builder removeLanguages(int index) { + if (languagesBuilder_ == null) { + ensureLanguagesIsMutable(); + languages_.remove(index); + onChanged(); + } else { + languagesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.SupportedLanguage.Builder getLanguagesBuilder(int index) { + return getLanguagesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.SupportedLanguageOrBuilder getLanguagesOrBuilder( + int index) { + if (languagesBuilder_ == null) { + return languages_.get(index); + } else { + return languagesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public java.util.List + getLanguagesOrBuilderList() { + if (languagesBuilder_ != null) { + return languagesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(languages_); + } + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.SupportedLanguage.Builder addLanguagesBuilder() { + return getLanguagesFieldBuilder() + .addBuilder(com.google.cloud.translate.v3.SupportedLanguage.getDefaultInstance()); + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public com.google.cloud.translate.v3.SupportedLanguage.Builder addLanguagesBuilder(int index) { + return getLanguagesFieldBuilder() + .addBuilder(index, com.google.cloud.translate.v3.SupportedLanguage.getDefaultInstance()); + } + /** + * + * + *
+     * A list of supported language responses. This list contains an entry
+     * for each language the Translation API supports.
+     * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + public java.util.List + getLanguagesBuilderList() { + return getLanguagesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.SupportedLanguage, + com.google.cloud.translate.v3.SupportedLanguage.Builder, + com.google.cloud.translate.v3.SupportedLanguageOrBuilder> + getLanguagesFieldBuilder() { + if (languagesBuilder_ == null) { + languagesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.SupportedLanguage, + com.google.cloud.translate.v3.SupportedLanguage.Builder, + com.google.cloud.translate.v3.SupportedLanguageOrBuilder>( + languages_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + languages_ = null; + } + return languagesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.SupportedLanguages) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.SupportedLanguages) + private static final com.google.cloud.translate.v3.SupportedLanguages DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.SupportedLanguages(); + } + + public static com.google.cloud.translate.v3.SupportedLanguages getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SupportedLanguages parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SupportedLanguages(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.SupportedLanguages getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguagesOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguagesOrBuilder.java new file mode 100644 index 00000000..27c1e288 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/SupportedLanguagesOrBuilder.java @@ -0,0 +1,82 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface SupportedLanguagesOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.SupportedLanguages) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + java.util.List getLanguagesList(); + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + com.google.cloud.translate.v3.SupportedLanguage getLanguages(int index); + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + int getLanguagesCount(); + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + java.util.List + getLanguagesOrBuilderList(); + /** + * + * + *
+   * A list of supported language responses. This list contains an entry
+   * for each language the Translation API supports.
+   * 
+ * + * repeated .google.cloud.translation.v3.SupportedLanguage languages = 1; + */ + com.google.cloud.translate.v3.SupportedLanguageOrBuilder getLanguagesOrBuilder(int index); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextGlossaryConfig.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextGlossaryConfig.java new file mode 100644 index 00000000..280ec75a --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextGlossaryConfig.java @@ -0,0 +1,706 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * Configures which glossary should be used for a specific target language,
+ * and defines options for applying that glossary.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.TranslateTextGlossaryConfig} + */ +public final class TranslateTextGlossaryConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.TranslateTextGlossaryConfig) + TranslateTextGlossaryConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use TranslateTextGlossaryConfig.newBuilder() to construct. + private TranslateTextGlossaryConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private TranslateTextGlossaryConfig() { + glossary_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private TranslateTextGlossaryConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + glossary_ = s; + break; + } + case 16: + { + ignoreCase_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.class, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder.class); + } + + public static final int GLOSSARY_FIELD_NUMBER = 1; + private volatile java.lang.Object glossary_; + /** + * + * + *
+   * Required. Specifies the glossary used for this translation. Use
+   * this format: projects/*/locations/*/glossaries/*
+   * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getGlossary() { + java.lang.Object ref = glossary_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + glossary_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Specifies the glossary used for this translation. Use
+   * this format: projects/*/locations/*/glossaries/*
+   * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getGlossaryBytes() { + java.lang.Object ref = glossary_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + glossary_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int IGNORE_CASE_FIELD_NUMBER = 2; + private boolean ignoreCase_; + /** + * + * + *
+   * Optional. Indicates match is case-insensitive.
+   * Default value is false if missing.
+   * 
+ * + * bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean getIgnoreCase() { + return ignoreCase_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getGlossaryBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, glossary_); + } + if (ignoreCase_ != false) { + output.writeBool(2, ignoreCase_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getGlossaryBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, glossary_); + } + if (ignoreCase_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, ignoreCase_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.TranslateTextGlossaryConfig)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.TranslateTextGlossaryConfig other = + (com.google.cloud.translate.v3.TranslateTextGlossaryConfig) obj; + + if (!getGlossary().equals(other.getGlossary())) return false; + if (getIgnoreCase() != other.getIgnoreCase()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + GLOSSARY_FIELD_NUMBER; + hash = (53 * hash) + getGlossary().hashCode(); + hash = (37 * hash) + IGNORE_CASE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getIgnoreCase()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Configures which glossary should be used for a specific target language,
+   * and defines options for applying that glossary.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.TranslateTextGlossaryConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.TranslateTextGlossaryConfig) + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.class, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.TranslateTextGlossaryConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + glossary_ = ""; + + ignoreCase_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getDefaultInstanceForType() { + return com.google.cloud.translate.v3.TranslateTextGlossaryConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig build() { + com.google.cloud.translate.v3.TranslateTextGlossaryConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig buildPartial() { + com.google.cloud.translate.v3.TranslateTextGlossaryConfig result = + new com.google.cloud.translate.v3.TranslateTextGlossaryConfig(this); + result.glossary_ = glossary_; + result.ignoreCase_ = ignoreCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.TranslateTextGlossaryConfig) { + return mergeFrom((com.google.cloud.translate.v3.TranslateTextGlossaryConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.TranslateTextGlossaryConfig other) { + if (other == com.google.cloud.translate.v3.TranslateTextGlossaryConfig.getDefaultInstance()) + return this; + if (!other.getGlossary().isEmpty()) { + glossary_ = other.glossary_; + onChanged(); + } + if (other.getIgnoreCase() != false) { + setIgnoreCase(other.getIgnoreCase()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.TranslateTextGlossaryConfig parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.TranslateTextGlossaryConfig) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object glossary_ = ""; + /** + * + * + *
+     * Required. Specifies the glossary used for this translation. Use
+     * this format: projects/*/locations/*/glossaries/*
+     * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getGlossary() { + java.lang.Object ref = glossary_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + glossary_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Specifies the glossary used for this translation. Use
+     * this format: projects/*/locations/*/glossaries/*
+     * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getGlossaryBytes() { + java.lang.Object ref = glossary_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + glossary_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Specifies the glossary used for this translation. Use
+     * this format: projects/*/locations/*/glossaries/*
+     * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setGlossary(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + glossary_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Specifies the glossary used for this translation. Use
+     * this format: projects/*/locations/*/glossaries/*
+     * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearGlossary() { + + glossary_ = getDefaultInstance().getGlossary(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Specifies the glossary used for this translation. Use
+     * this format: projects/*/locations/*/glossaries/*
+     * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setGlossaryBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + glossary_ = value; + onChanged(); + return this; + } + + private boolean ignoreCase_; + /** + * + * + *
+     * Optional. Indicates match is case-insensitive.
+     * Default value is false if missing.
+     * 
+ * + * bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean getIgnoreCase() { + return ignoreCase_; + } + /** + * + * + *
+     * Optional. Indicates match is case-insensitive.
+     * Default value is false if missing.
+     * 
+ * + * bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setIgnoreCase(boolean value) { + + ignoreCase_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Indicates match is case-insensitive.
+     * Default value is false if missing.
+     * 
+ * + * bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearIgnoreCase() { + + ignoreCase_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.TranslateTextGlossaryConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.TranslateTextGlossaryConfig) + private static final com.google.cloud.translate.v3.TranslateTextGlossaryConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.TranslateTextGlossaryConfig(); + } + + public static com.google.cloud.translate.v3.TranslateTextGlossaryConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TranslateTextGlossaryConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TranslateTextGlossaryConfig(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextGlossaryConfigOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextGlossaryConfigOrBuilder.java new file mode 100644 index 00000000..76c0832f --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextGlossaryConfigOrBuilder.java @@ -0,0 +1,60 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface TranslateTextGlossaryConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.TranslateTextGlossaryConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Specifies the glossary used for this translation. Use
+   * this format: projects/*/locations/*/glossaries/*
+   * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + java.lang.String getGlossary(); + /** + * + * + *
+   * Required. Specifies the glossary used for this translation. Use
+   * this format: projects/*/locations/*/glossaries/*
+   * 
+ * + * string glossary = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.protobuf.ByteString getGlossaryBytes(); + + /** + * + * + *
+   * Optional. Indicates match is case-insensitive.
+   * Default value is false if missing.
+   * 
+ * + * bool ignore_case = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + boolean getIgnoreCase(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextRequest.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextRequest.java new file mode 100644 index 00000000..4745955d --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextRequest.java @@ -0,0 +1,2405 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * The request message for synchronous translation.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.TranslateTextRequest} + */ +public final class TranslateTextRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.TranslateTextRequest) + TranslateTextRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use TranslateTextRequest.newBuilder() to construct. + private TranslateTextRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private TranslateTextRequest() { + contents_ = com.google.protobuf.LazyStringArrayList.EMPTY; + mimeType_ = ""; + sourceLanguageCode_ = ""; + targetLanguageCode_ = ""; + parent_ = ""; + model_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private TranslateTextRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + contents_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + contents_.add(s); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + mimeType_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + sourceLanguageCode_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + targetLanguageCode_ = s; + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + model_ = s; + break; + } + case 58: + { + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder subBuilder = null; + if (glossaryConfig_ != null) { + subBuilder = glossaryConfig_.toBuilder(); + } + glossaryConfig_ = + input.readMessage( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(glossaryConfig_); + glossaryConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 66: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 82: + { + if (!((mutable_bitField0_ & 0x00000080) != 0)) { + labels_ = + com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000080; + } + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + contents_ = contents_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextRequest_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 10: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.TranslateTextRequest.class, + com.google.cloud.translate.v3.TranslateTextRequest.Builder.class); + } + + private int bitField0_; + public static final int CONTENTS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList contents_; + /** + * + * + *
+   * Required. The content of the input in string format.
+   * We recommend the total content be less than 30k codepoints.
+   * Use BatchTranslateText for larger text.
+   * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ProtocolStringList getContentsList() { + return contents_; + } + /** + * + * + *
+   * Required. The content of the input in string format.
+   * We recommend the total content be less than 30k codepoints.
+   * Use BatchTranslateText for larger text.
+   * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public int getContentsCount() { + return contents_.size(); + } + /** + * + * + *
+   * Required. The content of the input in string format.
+   * We recommend the total content be less than 30k codepoints.
+   * Use BatchTranslateText for larger text.
+   * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getContents(int index) { + return contents_.get(index); + } + /** + * + * + *
+   * Required. The content of the input in string format.
+   * We recommend the total content be less than 30k codepoints.
+   * Use BatchTranslateText for larger text.
+   * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getContentsBytes(int index) { + return contents_.getByteString(index); + } + + public static final int MIME_TYPE_FIELD_NUMBER = 3; + private volatile java.lang.Object mimeType_; + /** + * + * + *
+   * Optional. The format of the source text, for example, "text/html",
+   *  "text/plain". If left blank, the MIME type defaults to "text/html".
+   * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The format of the source text, for example, "text/html",
+   *  "text/plain". If left blank, the MIME type defaults to "text/html".
+   * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SOURCE_LANGUAGE_CODE_FIELD_NUMBER = 4; + private volatile java.lang.Object sourceLanguageCode_; + /** + * + * + *
+   * Optional. The BCP-47 language code of the input text if
+   * known, for example, "en-US" or "sr-Latn". Supported language codes are
+   * listed in Language Support. If the source language isn't specified, the API
+   * attempts to identify the source language automatically and returns the
+   * source language within the response.
+   * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getSourceLanguageCode() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceLanguageCode_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The BCP-47 language code of the input text if
+   * known, for example, "en-US" or "sr-Latn". Supported language codes are
+   * listed in Language Support. If the source language isn't specified, the API
+   * attempts to identify the source language automatically and returns the
+   * source language within the response.
+   * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getSourceLanguageCodeBytes() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sourceLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TARGET_LANGUAGE_CODE_FIELD_NUMBER = 5; + private volatile java.lang.Object targetLanguageCode_; + /** + * + * + *
+   * Required. The BCP-47 language code to use for translation of the input
+   * text, set to one of the language codes listed in Language Support.
+   * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getTargetLanguageCode() { + java.lang.Object ref = targetLanguageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + targetLanguageCode_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The BCP-47 language code to use for translation of the input
+   * text, set to one of the language codes listed in Language Support.
+   * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getTargetLanguageCodeBytes() { + java.lang.Object ref = targetLanguageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + targetLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARENT_FIELD_NUMBER = 8; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}` or
+   * `projects/{project-number-or-id}/locations/{location-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Non-global location is required for requests using AutoML models or
+   * custom glossaries.
+   * Models and glossaries must be within the same region (have same
+   * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}` or
+   * `projects/{project-number-or-id}/locations/{location-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Non-global location is required for requests using AutoML models or
+   * custom glossaries.
+   * Models and glossaries must be within the same region (have same
+   * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MODEL_FIELD_NUMBER = 6; + private volatile java.lang.Object model_; + /** + * + * + *
+   * Optional. The `model` type requested for this translation.
+   * The format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * For global (non-regionalized) requests, use `location-id` `global`.
+   * For example,
+   * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+   * If missing, the system decides which google base model to use.
+   * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The `model` type requested for this translation.
+   * The format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * For global (non-regionalized) requests, use `location-id` `global`.
+   * For example,
+   * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+   * If missing, the system decides which google base model to use.
+   * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GLOSSARY_CONFIG_FIELD_NUMBER = 7; + private com.google.cloud.translate.v3.TranslateTextGlossaryConfig glossaryConfig_; + /** + * + * + *
+   * Optional. Glossary to be applied. The glossary must be
+   * within the same region (have the same location-id) as the model, otherwise
+   * an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean hasGlossaryConfig() { + return glossaryConfig_ != null; + } + /** + * + * + *
+   * Optional. Glossary to be applied. The glossary must be
+   * within the same region (have the same location-id) as the model, otherwise
+   * an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossaryConfig() { + return glossaryConfig_ == null + ? com.google.cloud.translate.v3.TranslateTextGlossaryConfig.getDefaultInstance() + : glossaryConfig_; + } + /** + * + * + *
+   * Optional. Glossary to be applied. The glossary must be
+   * within the same region (have the same location-id) as the model, otherwise
+   * an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder + getGlossaryConfigOrBuilder() { + return getGlossaryConfig(); + } + + public static final int LABELS_FIELD_NUMBER = 10; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextRequest_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < contents_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, contents_.getRaw(i)); + } + if (!getMimeTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, mimeType_); + } + if (!getSourceLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, sourceLanguageCode_); + } + if (!getTargetLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, targetLanguageCode_); + } + if (!getModelBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, model_); + } + if (glossaryConfig_ != null) { + output.writeMessage(7, getGlossaryConfig()); + } + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, parent_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 10); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < contents_.size(); i++) { + dataSize += computeStringSizeNoTag(contents_.getRaw(i)); + } + size += dataSize; + size += 1 * getContentsList().size(); + } + if (!getMimeTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, mimeType_); + } + if (!getSourceLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, sourceLanguageCode_); + } + if (!getTargetLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, targetLanguageCode_); + } + if (!getModelBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, model_); + } + if (glossaryConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getGlossaryConfig()); + } + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, parent_); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, labels__); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.TranslateTextRequest)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.TranslateTextRequest other = + (com.google.cloud.translate.v3.TranslateTextRequest) obj; + + if (!getContentsList().equals(other.getContentsList())) return false; + if (!getMimeType().equals(other.getMimeType())) return false; + if (!getSourceLanguageCode().equals(other.getSourceLanguageCode())) return false; + if (!getTargetLanguageCode().equals(other.getTargetLanguageCode())) return false; + if (!getParent().equals(other.getParent())) return false; + if (!getModel().equals(other.getModel())) return false; + if (hasGlossaryConfig() != other.hasGlossaryConfig()) return false; + if (hasGlossaryConfig()) { + if (!getGlossaryConfig().equals(other.getGlossaryConfig())) return false; + } + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getContentsCount() > 0) { + hash = (37 * hash) + CONTENTS_FIELD_NUMBER; + hash = (53 * hash) + getContentsList().hashCode(); + } + hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getMimeType().hashCode(); + hash = (37 * hash) + SOURCE_LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getSourceLanguageCode().hashCode(); + hash = (37 * hash) + TARGET_LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getTargetLanguageCode().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + MODEL_FIELD_NUMBER; + hash = (53 * hash) + getModel().hashCode(); + if (hasGlossaryConfig()) { + hash = (37 * hash) + GLOSSARY_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getGlossaryConfig().hashCode(); + } + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.TranslateTextRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request message for synchronous translation.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.TranslateTextRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.TranslateTextRequest) + com.google.cloud.translate.v3.TranslateTextRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextRequest_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 10: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 10: + return internalGetMutableLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.TranslateTextRequest.class, + com.google.cloud.translate.v3.TranslateTextRequest.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.TranslateTextRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + contents_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + mimeType_ = ""; + + sourceLanguageCode_ = ""; + + targetLanguageCode_ = ""; + + parent_ = ""; + + model_ = ""; + + if (glossaryConfigBuilder_ == null) { + glossaryConfig_ = null; + } else { + glossaryConfig_ = null; + glossaryConfigBuilder_ = null; + } + internalGetMutableLabels().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextRequest getDefaultInstanceForType() { + return com.google.cloud.translate.v3.TranslateTextRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextRequest build() { + com.google.cloud.translate.v3.TranslateTextRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextRequest buildPartial() { + com.google.cloud.translate.v3.TranslateTextRequest result = + new com.google.cloud.translate.v3.TranslateTextRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((bitField0_ & 0x00000001) != 0)) { + contents_ = contents_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.contents_ = contents_; + result.mimeType_ = mimeType_; + result.sourceLanguageCode_ = sourceLanguageCode_; + result.targetLanguageCode_ = targetLanguageCode_; + result.parent_ = parent_; + result.model_ = model_; + if (glossaryConfigBuilder_ == null) { + result.glossaryConfig_ = glossaryConfig_; + } else { + result.glossaryConfig_ = glossaryConfigBuilder_.build(); + } + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.TranslateTextRequest) { + return mergeFrom((com.google.cloud.translate.v3.TranslateTextRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.TranslateTextRequest other) { + if (other == com.google.cloud.translate.v3.TranslateTextRequest.getDefaultInstance()) + return this; + if (!other.contents_.isEmpty()) { + if (contents_.isEmpty()) { + contents_ = other.contents_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureContentsIsMutable(); + contents_.addAll(other.contents_); + } + onChanged(); + } + if (!other.getMimeType().isEmpty()) { + mimeType_ = other.mimeType_; + onChanged(); + } + if (!other.getSourceLanguageCode().isEmpty()) { + sourceLanguageCode_ = other.sourceLanguageCode_; + onChanged(); + } + if (!other.getTargetLanguageCode().isEmpty()) { + targetLanguageCode_ = other.targetLanguageCode_; + onChanged(); + } + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getModel().isEmpty()) { + model_ = other.model_; + onChanged(); + } + if (other.hasGlossaryConfig()) { + mergeGlossaryConfig(other.getGlossaryConfig()); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.TranslateTextRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.TranslateTextRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList contents_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureContentsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + contents_ = new com.google.protobuf.LazyStringArrayList(contents_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ProtocolStringList getContentsList() { + return contents_.getUnmodifiableView(); + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public int getContentsCount() { + return contents_.size(); + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getContents(int index) { + return contents_.get(index); + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getContentsBytes(int index) { + return contents_.getByteString(index); + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setContents(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentsIsMutable(); + contents_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder addContents(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentsIsMutable(); + contents_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder addAllContents(java.lang.Iterable values) { + ensureContentsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, contents_); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearContents() { + contents_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The content of the input in string format.
+     * We recommend the total content be less than 30k codepoints.
+     * Use BatchTranslateText for larger text.
+     * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder addContentsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureContentsIsMutable(); + contents_.add(value); + onChanged(); + return this; + } + + private java.lang.Object mimeType_ = ""; + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     *  "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     *  "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     *  "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setMimeType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + mimeType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     *  "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearMimeType() { + + mimeType_ = getDefaultInstance().getMimeType(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The format of the source text, for example, "text/html",
+     *  "text/plain". If left blank, the MIME type defaults to "text/html".
+     * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setMimeTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + mimeType_ = value; + onChanged(); + return this; + } + + private java.lang.Object sourceLanguageCode_ = ""; + /** + * + * + *
+     * Optional. The BCP-47 language code of the input text if
+     * known, for example, "en-US" or "sr-Latn". Supported language codes are
+     * listed in Language Support. If the source language isn't specified, the API
+     * attempts to identify the source language automatically and returns the
+     * source language within the response.
+     * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getSourceLanguageCode() { + java.lang.Object ref = sourceLanguageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sourceLanguageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The BCP-47 language code of the input text if
+     * known, for example, "en-US" or "sr-Latn". Supported language codes are
+     * listed in Language Support. If the source language isn't specified, the API
+     * attempts to identify the source language automatically and returns the
+     * source language within the response.
+     * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getSourceLanguageCodeBytes() { + java.lang.Object ref = sourceLanguageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sourceLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The BCP-47 language code of the input text if
+     * known, for example, "en-US" or "sr-Latn". Supported language codes are
+     * listed in Language Support. If the source language isn't specified, the API
+     * attempts to identify the source language automatically and returns the
+     * source language within the response.
+     * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setSourceLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sourceLanguageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The BCP-47 language code of the input text if
+     * known, for example, "en-US" or "sr-Latn". Supported language codes are
+     * listed in Language Support. If the source language isn't specified, the API
+     * attempts to identify the source language automatically and returns the
+     * source language within the response.
+     * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearSourceLanguageCode() { + + sourceLanguageCode_ = getDefaultInstance().getSourceLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The BCP-47 language code of the input text if
+     * known, for example, "en-US" or "sr-Latn". Supported language codes are
+     * listed in Language Support. If the source language isn't specified, the API
+     * attempts to identify the source language automatically and returns the
+     * source language within the response.
+     * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setSourceLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sourceLanguageCode_ = value; + onChanged(); + return this; + } + + private java.lang.Object targetLanguageCode_ = ""; + /** + * + * + *
+     * Required. The BCP-47 language code to use for translation of the input
+     * text, set to one of the language codes listed in Language Support.
+     * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getTargetLanguageCode() { + java.lang.Object ref = targetLanguageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + targetLanguageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The BCP-47 language code to use for translation of the input
+     * text, set to one of the language codes listed in Language Support.
+     * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getTargetLanguageCodeBytes() { + java.lang.Object ref = targetLanguageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + targetLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The BCP-47 language code to use for translation of the input
+     * text, set to one of the language codes listed in Language Support.
+     * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setTargetLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + targetLanguageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The BCP-47 language code to use for translation of the input
+     * text, set to one of the language codes listed in Language Support.
+     * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearTargetLanguageCode() { + + targetLanguageCode_ = getDefaultInstance().getTargetLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The BCP-47 language code to use for translation of the input
+     * text, set to one of the language codes listed in Language Support.
+     * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setTargetLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + targetLanguageCode_ = value; + onChanged(); + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for requests using AutoML models or
+     * custom glossaries.
+     * Models and glossaries must be within the same region (have same
+     * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for requests using AutoML models or
+     * custom glossaries.
+     * Models and glossaries must be within the same region (have same
+     * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for requests using AutoML models or
+     * custom glossaries.
+     * Models and glossaries must be within the same region (have same
+     * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for requests using AutoML models or
+     * custom glossaries.
+     * Models and glossaries must be within the same region (have same
+     * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Project or location to make a call. Must refer to a caller's
+     * project.
+     * Format: `projects/{project-number-or-id}` or
+     * `projects/{project-number-or-id}/locations/{location-id}`.
+     * For global calls, use `projects/{project-number-or-id}/locations/global` or
+     * `projects/{project-number-or-id}`.
+     * Non-global location is required for requests using AutoML models or
+     * custom glossaries.
+     * Models and glossaries must be within the same region (have same
+     * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object model_ = ""; + /** + * + * + *
+     * Optional. The `model` type requested for this translation.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * For global (non-regionalized) requests, use `location-id` `global`.
+     * For example,
+     * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+     * If missing, the system decides which google base model to use.
+     * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The `model` type requested for this translation.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * For global (non-regionalized) requests, use `location-id` `global`.
+     * For example,
+     * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+     * If missing, the system decides which google base model to use.
+     * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The `model` type requested for this translation.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * For global (non-regionalized) requests, use `location-id` `global`.
+     * For example,
+     * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+     * If missing, the system decides which google base model to use.
+     * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setModel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + model_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The `model` type requested for this translation.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * For global (non-regionalized) requests, use `location-id` `global`.
+     * For example,
+     * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+     * If missing, the system decides which google base model to use.
+     * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearModel() { + + model_ = getDefaultInstance().getModel(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The `model` type requested for this translation.
+     * The format depends on model type:
+     * - AutoML Translation models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+     * - General (built-in) models:
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+     *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+     * For global (non-regionalized) requests, use `location-id` `global`.
+     * For example,
+     * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+     * If missing, the system decides which google base model to use.
+     * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setModelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + model_ = value; + onChanged(); + return this; + } + + private com.google.cloud.translate.v3.TranslateTextGlossaryConfig glossaryConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.TranslateTextGlossaryConfig, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder, + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder> + glossaryConfigBuilder_; + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean hasGlossaryConfig() { + return glossaryConfigBuilder_ != null || glossaryConfig_ != null; + } + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossaryConfig() { + if (glossaryConfigBuilder_ == null) { + return glossaryConfig_ == null + ? com.google.cloud.translate.v3.TranslateTextGlossaryConfig.getDefaultInstance() + : glossaryConfig_; + } else { + return glossaryConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setGlossaryConfig( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig value) { + if (glossaryConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + glossaryConfig_ = value; + onChanged(); + } else { + glossaryConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setGlossaryConfig( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder builderForValue) { + if (glossaryConfigBuilder_ == null) { + glossaryConfig_ = builderForValue.build(); + onChanged(); + } else { + glossaryConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeGlossaryConfig( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig value) { + if (glossaryConfigBuilder_ == null) { + if (glossaryConfig_ != null) { + glossaryConfig_ = + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.newBuilder(glossaryConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + glossaryConfig_ = value; + } + onChanged(); + } else { + glossaryConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearGlossaryConfig() { + if (glossaryConfigBuilder_ == null) { + glossaryConfig_ = null; + onChanged(); + } else { + glossaryConfig_ = null; + glossaryConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder + getGlossaryConfigBuilder() { + + onChanged(); + return getGlossaryConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder + getGlossaryConfigOrBuilder() { + if (glossaryConfigBuilder_ != null) { + return glossaryConfigBuilder_.getMessageOrBuilder(); + } else { + return glossaryConfig_ == null + ? com.google.cloud.translate.v3.TranslateTextGlossaryConfig.getDefaultInstance() + : glossaryConfig_; + } + } + /** + * + * + *
+     * Optional. Glossary to be applied. The glossary must be
+     * within the same region (have the same location-id) as the model, otherwise
+     * an INVALID_ARGUMENT (400) error is returned.
+     * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.TranslateTextGlossaryConfig, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder, + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder> + getGlossaryConfigFieldBuilder() { + if (glossaryConfigBuilder_ == null) { + glossaryConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.TranslateTextGlossaryConfig, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder, + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder>( + getGlossaryConfig(), getParentForChildren(), isClean()); + glossaryConfig_ = null; + } + return glossaryConfigBuilder_; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Optional. The labels with user-defined metadata for the request.
+     * Label keys and values can be no longer than 63 characters
+     * (Unicode codepoints), can only contain lowercase letters, numeric
+     * characters, underscores and dashes. International characters are allowed.
+     * Label values are optional. Label keys must start with a letter.
+     * See https://cloud.google.com/translate/docs/labels for more information.
+     * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.TranslateTextRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.TranslateTextRequest) + private static final com.google.cloud.translate.v3.TranslateTextRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.TranslateTextRequest(); + } + + public static com.google.cloud.translate.v3.TranslateTextRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TranslateTextRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TranslateTextRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextRequestOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextRequestOrBuilder.java new file mode 100644 index 00000000..eabf13a0 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextRequestOrBuilder.java @@ -0,0 +1,355 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface TranslateTextRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.TranslateTextRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The content of the input in string format.
+   * We recommend the total content be less than 30k codepoints.
+   * Use BatchTranslateText for larger text.
+   * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + java.util.List getContentsList(); + /** + * + * + *
+   * Required. The content of the input in string format.
+   * We recommend the total content be less than 30k codepoints.
+   * Use BatchTranslateText for larger text.
+   * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + int getContentsCount(); + /** + * + * + *
+   * Required. The content of the input in string format.
+   * We recommend the total content be less than 30k codepoints.
+   * Use BatchTranslateText for larger text.
+   * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + java.lang.String getContents(int index); + /** + * + * + *
+   * Required. The content of the input in string format.
+   * We recommend the total content be less than 30k codepoints.
+   * Use BatchTranslateText for larger text.
+   * 
+ * + * repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.protobuf.ByteString getContentsBytes(int index); + + /** + * + * + *
+   * Optional. The format of the source text, for example, "text/html",
+   *  "text/plain". If left blank, the MIME type defaults to "text/html".
+   * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getMimeType(); + /** + * + * + *
+   * Optional. The format of the source text, for example, "text/html",
+   *  "text/plain". If left blank, the MIME type defaults to "text/html".
+   * 
+ * + * string mime_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getMimeTypeBytes(); + + /** + * + * + *
+   * Optional. The BCP-47 language code of the input text if
+   * known, for example, "en-US" or "sr-Latn". Supported language codes are
+   * listed in Language Support. If the source language isn't specified, the API
+   * attempts to identify the source language automatically and returns the
+   * source language within the response.
+   * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getSourceLanguageCode(); + /** + * + * + *
+   * Optional. The BCP-47 language code of the input text if
+   * known, for example, "en-US" or "sr-Latn". Supported language codes are
+   * listed in Language Support. If the source language isn't specified, the API
+   * attempts to identify the source language automatically and returns the
+   * source language within the response.
+   * 
+ * + * string source_language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getSourceLanguageCodeBytes(); + + /** + * + * + *
+   * Required. The BCP-47 language code to use for translation of the input
+   * text, set to one of the language codes listed in Language Support.
+   * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + java.lang.String getTargetLanguageCode(); + /** + * + * + *
+   * Required. The BCP-47 language code to use for translation of the input
+   * text, set to one of the language codes listed in Language Support.
+   * 
+ * + * string target_language_code = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.protobuf.ByteString getTargetLanguageCodeBytes(); + + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}` or
+   * `projects/{project-number-or-id}/locations/{location-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Non-global location is required for requests using AutoML models or
+   * custom glossaries.
+   * Models and glossaries must be within the same region (have same
+   * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Project or location to make a call. Must refer to a caller's
+   * project.
+   * Format: `projects/{project-number-or-id}` or
+   * `projects/{project-number-or-id}/locations/{location-id}`.
+   * For global calls, use `projects/{project-number-or-id}/locations/global` or
+   * `projects/{project-number-or-id}`.
+   * Non-global location is required for requests using AutoML models or
+   * custom glossaries.
+   * Models and glossaries must be within the same region (have same
+   * location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * string parent = 8 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. The `model` type requested for this translation.
+   * The format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * For global (non-regionalized) requests, use `location-id` `global`.
+   * For example,
+   * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+   * If missing, the system decides which google base model to use.
+   * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getModel(); + /** + * + * + *
+   * Optional. The `model` type requested for this translation.
+   * The format depends on model type:
+   * - AutoML Translation models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
+   * - General (built-in) models:
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
+   *   `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
+   * For global (non-regionalized) requests, use `location-id` `global`.
+   * For example,
+   * `projects/{project-number-or-id}/locations/global/models/general/nmt`.
+   * If missing, the system decides which google base model to use.
+   * 
+ * + * string model = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getModelBytes(); + + /** + * + * + *
+   * Optional. Glossary to be applied. The glossary must be
+   * within the same region (have the same location-id) as the model, otherwise
+   * an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean hasGlossaryConfig(); + /** + * + * + *
+   * Optional. Glossary to be applied. The glossary must be
+   * within the same region (have the same location-id) as the model, otherwise
+   * an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossaryConfig(); + /** + * + * + *
+   * Optional. Glossary to be applied. The glossary must be
+   * within the same region (have the same location-id) as the model, otherwise
+   * an INVALID_ARGUMENT (400) error is returned.
+   * 
+ * + * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder getGlossaryConfigOrBuilder(); + + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getLabelsCount(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * Optional. The labels with user-defined metadata for the request.
+   * Label keys and values can be no longer than 63 characters
+   * (Unicode codepoints), can only contain lowercase letters, numeric
+   * characters, underscores and dashes. International characters are allowed.
+   * Label values are optional. Label keys must start with a letter.
+   * See https://cloud.google.com/translate/docs/labels for more information.
+   * 
+ * + * map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextResponse.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextResponse.java new file mode 100644 index 00000000..034d4a49 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextResponse.java @@ -0,0 +1,1559 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** Protobuf type {@code google.cloud.translation.v3.TranslateTextResponse} */ +public final class TranslateTextResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.TranslateTextResponse) + TranslateTextResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use TranslateTextResponse.newBuilder() to construct. + private TranslateTextResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private TranslateTextResponse() { + translations_ = java.util.Collections.emptyList(); + glossaryTranslations_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private TranslateTextResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + translations_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + translations_.add( + input.readMessage( + com.google.cloud.translate.v3.Translation.parser(), extensionRegistry)); + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + glossaryTranslations_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + glossaryTranslations_.add( + input.readMessage( + com.google.cloud.translate.v3.Translation.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + translations_ = java.util.Collections.unmodifiableList(translations_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + glossaryTranslations_ = java.util.Collections.unmodifiableList(glossaryTranslations_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.TranslateTextResponse.class, + com.google.cloud.translate.v3.TranslateTextResponse.Builder.class); + } + + public static final int TRANSLATIONS_FIELD_NUMBER = 1; + private java.util.List translations_; + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public java.util.List getTranslationsList() { + return translations_; + } + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public java.util.List + getTranslationsOrBuilderList() { + return translations_; + } + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public int getTranslationsCount() { + return translations_.size(); + } + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public com.google.cloud.translate.v3.Translation getTranslations(int index) { + return translations_.get(index); + } + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public com.google.cloud.translate.v3.TranslationOrBuilder getTranslationsOrBuilder(int index) { + return translations_.get(index); + } + + public static final int GLOSSARY_TRANSLATIONS_FIELD_NUMBER = 3; + private java.util.List glossaryTranslations_; + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public java.util.List getGlossaryTranslationsList() { + return glossaryTranslations_; + } + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public java.util.List + getGlossaryTranslationsOrBuilderList() { + return glossaryTranslations_; + } + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public int getGlossaryTranslationsCount() { + return glossaryTranslations_.size(); + } + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public com.google.cloud.translate.v3.Translation getGlossaryTranslations(int index) { + return glossaryTranslations_.get(index); + } + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public com.google.cloud.translate.v3.TranslationOrBuilder getGlossaryTranslationsOrBuilder( + int index) { + return glossaryTranslations_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < translations_.size(); i++) { + output.writeMessage(1, translations_.get(i)); + } + for (int i = 0; i < glossaryTranslations_.size(); i++) { + output.writeMessage(3, glossaryTranslations_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < translations_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, translations_.get(i)); + } + for (int i = 0; i < glossaryTranslations_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(3, glossaryTranslations_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.TranslateTextResponse)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.TranslateTextResponse other = + (com.google.cloud.translate.v3.TranslateTextResponse) obj; + + if (!getTranslationsList().equals(other.getTranslationsList())) return false; + if (!getGlossaryTranslationsList().equals(other.getGlossaryTranslationsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getTranslationsCount() > 0) { + hash = (37 * hash) + TRANSLATIONS_FIELD_NUMBER; + hash = (53 * hash) + getTranslationsList().hashCode(); + } + if (getGlossaryTranslationsCount() > 0) { + hash = (37 * hash) + GLOSSARY_TRANSLATIONS_FIELD_NUMBER; + hash = (53 * hash) + getGlossaryTranslationsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.TranslateTextResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** Protobuf type {@code google.cloud.translation.v3.TranslateTextResponse} */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.TranslateTextResponse) + com.google.cloud.translate.v3.TranslateTextResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.TranslateTextResponse.class, + com.google.cloud.translate.v3.TranslateTextResponse.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.TranslateTextResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getTranslationsFieldBuilder(); + getGlossaryTranslationsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (translationsBuilder_ == null) { + translations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + translationsBuilder_.clear(); + } + if (glossaryTranslationsBuilder_ == null) { + glossaryTranslations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + glossaryTranslationsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_TranslateTextResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextResponse getDefaultInstanceForType() { + return com.google.cloud.translate.v3.TranslateTextResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextResponse build() { + com.google.cloud.translate.v3.TranslateTextResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextResponse buildPartial() { + com.google.cloud.translate.v3.TranslateTextResponse result = + new com.google.cloud.translate.v3.TranslateTextResponse(this); + int from_bitField0_ = bitField0_; + if (translationsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + translations_ = java.util.Collections.unmodifiableList(translations_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.translations_ = translations_; + } else { + result.translations_ = translationsBuilder_.build(); + } + if (glossaryTranslationsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + glossaryTranslations_ = java.util.Collections.unmodifiableList(glossaryTranslations_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.glossaryTranslations_ = glossaryTranslations_; + } else { + result.glossaryTranslations_ = glossaryTranslationsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.TranslateTextResponse) { + return mergeFrom((com.google.cloud.translate.v3.TranslateTextResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.TranslateTextResponse other) { + if (other == com.google.cloud.translate.v3.TranslateTextResponse.getDefaultInstance()) + return this; + if (translationsBuilder_ == null) { + if (!other.translations_.isEmpty()) { + if (translations_.isEmpty()) { + translations_ = other.translations_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTranslationsIsMutable(); + translations_.addAll(other.translations_); + } + onChanged(); + } + } else { + if (!other.translations_.isEmpty()) { + if (translationsBuilder_.isEmpty()) { + translationsBuilder_.dispose(); + translationsBuilder_ = null; + translations_ = other.translations_; + bitField0_ = (bitField0_ & ~0x00000001); + translationsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getTranslationsFieldBuilder() + : null; + } else { + translationsBuilder_.addAllMessages(other.translations_); + } + } + } + if (glossaryTranslationsBuilder_ == null) { + if (!other.glossaryTranslations_.isEmpty()) { + if (glossaryTranslations_.isEmpty()) { + glossaryTranslations_ = other.glossaryTranslations_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureGlossaryTranslationsIsMutable(); + glossaryTranslations_.addAll(other.glossaryTranslations_); + } + onChanged(); + } + } else { + if (!other.glossaryTranslations_.isEmpty()) { + if (glossaryTranslationsBuilder_.isEmpty()) { + glossaryTranslationsBuilder_.dispose(); + glossaryTranslationsBuilder_ = null; + glossaryTranslations_ = other.glossaryTranslations_; + bitField0_ = (bitField0_ & ~0x00000002); + glossaryTranslationsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getGlossaryTranslationsFieldBuilder() + : null; + } else { + glossaryTranslationsBuilder_.addAllMessages(other.glossaryTranslations_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.TranslateTextResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.translate.v3.TranslateTextResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List translations_ = + java.util.Collections.emptyList(); + + private void ensureTranslationsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + translations_ = + new java.util.ArrayList(translations_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Translation, + com.google.cloud.translate.v3.Translation.Builder, + com.google.cloud.translate.v3.TranslationOrBuilder> + translationsBuilder_; + + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public java.util.List getTranslationsList() { + if (translationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(translations_); + } else { + return translationsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public int getTranslationsCount() { + if (translationsBuilder_ == null) { + return translations_.size(); + } else { + return translationsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public com.google.cloud.translate.v3.Translation getTranslations(int index) { + if (translationsBuilder_ == null) { + return translations_.get(index); + } else { + return translationsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder setTranslations(int index, com.google.cloud.translate.v3.Translation value) { + if (translationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTranslationsIsMutable(); + translations_.set(index, value); + onChanged(); + } else { + translationsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder setTranslations( + int index, com.google.cloud.translate.v3.Translation.Builder builderForValue) { + if (translationsBuilder_ == null) { + ensureTranslationsIsMutable(); + translations_.set(index, builderForValue.build()); + onChanged(); + } else { + translationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder addTranslations(com.google.cloud.translate.v3.Translation value) { + if (translationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTranslationsIsMutable(); + translations_.add(value); + onChanged(); + } else { + translationsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder addTranslations(int index, com.google.cloud.translate.v3.Translation value) { + if (translationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTranslationsIsMutable(); + translations_.add(index, value); + onChanged(); + } else { + translationsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder addTranslations( + com.google.cloud.translate.v3.Translation.Builder builderForValue) { + if (translationsBuilder_ == null) { + ensureTranslationsIsMutable(); + translations_.add(builderForValue.build()); + onChanged(); + } else { + translationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder addTranslations( + int index, com.google.cloud.translate.v3.Translation.Builder builderForValue) { + if (translationsBuilder_ == null) { + ensureTranslationsIsMutable(); + translations_.add(index, builderForValue.build()); + onChanged(); + } else { + translationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder addAllTranslations( + java.lang.Iterable values) { + if (translationsBuilder_ == null) { + ensureTranslationsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, translations_); + onChanged(); + } else { + translationsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder clearTranslations() { + if (translationsBuilder_ == null) { + translations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + translationsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public Builder removeTranslations(int index) { + if (translationsBuilder_ == null) { + ensureTranslationsIsMutable(); + translations_.remove(index); + onChanged(); + } else { + translationsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public com.google.cloud.translate.v3.Translation.Builder getTranslationsBuilder(int index) { + return getTranslationsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public com.google.cloud.translate.v3.TranslationOrBuilder getTranslationsOrBuilder(int index) { + if (translationsBuilder_ == null) { + return translations_.get(index); + } else { + return translationsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public java.util.List + getTranslationsOrBuilderList() { + if (translationsBuilder_ != null) { + return translationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(translations_); + } + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public com.google.cloud.translate.v3.Translation.Builder addTranslationsBuilder() { + return getTranslationsFieldBuilder() + .addBuilder(com.google.cloud.translate.v3.Translation.getDefaultInstance()); + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public com.google.cloud.translate.v3.Translation.Builder addTranslationsBuilder(int index) { + return getTranslationsFieldBuilder() + .addBuilder(index, com.google.cloud.translate.v3.Translation.getDefaultInstance()); + } + /** + * + * + *
+     * Text translation responses with no glossary applied.
+     * This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + public java.util.List + getTranslationsBuilderList() { + return getTranslationsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Translation, + com.google.cloud.translate.v3.Translation.Builder, + com.google.cloud.translate.v3.TranslationOrBuilder> + getTranslationsFieldBuilder() { + if (translationsBuilder_ == null) { + translationsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Translation, + com.google.cloud.translate.v3.Translation.Builder, + com.google.cloud.translate.v3.TranslationOrBuilder>( + translations_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + translations_ = null; + } + return translationsBuilder_; + } + + private java.util.List glossaryTranslations_ = + java.util.Collections.emptyList(); + + private void ensureGlossaryTranslationsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + glossaryTranslations_ = + new java.util.ArrayList( + glossaryTranslations_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Translation, + com.google.cloud.translate.v3.Translation.Builder, + com.google.cloud.translate.v3.TranslationOrBuilder> + glossaryTranslationsBuilder_; + + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public java.util.List getGlossaryTranslationsList() { + if (glossaryTranslationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(glossaryTranslations_); + } else { + return glossaryTranslationsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public int getGlossaryTranslationsCount() { + if (glossaryTranslationsBuilder_ == null) { + return glossaryTranslations_.size(); + } else { + return glossaryTranslationsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public com.google.cloud.translate.v3.Translation getGlossaryTranslations(int index) { + if (glossaryTranslationsBuilder_ == null) { + return glossaryTranslations_.get(index); + } else { + return glossaryTranslationsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder setGlossaryTranslations( + int index, com.google.cloud.translate.v3.Translation value) { + if (glossaryTranslationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlossaryTranslationsIsMutable(); + glossaryTranslations_.set(index, value); + onChanged(); + } else { + glossaryTranslationsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder setGlossaryTranslations( + int index, com.google.cloud.translate.v3.Translation.Builder builderForValue) { + if (glossaryTranslationsBuilder_ == null) { + ensureGlossaryTranslationsIsMutable(); + glossaryTranslations_.set(index, builderForValue.build()); + onChanged(); + } else { + glossaryTranslationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder addGlossaryTranslations(com.google.cloud.translate.v3.Translation value) { + if (glossaryTranslationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlossaryTranslationsIsMutable(); + glossaryTranslations_.add(value); + onChanged(); + } else { + glossaryTranslationsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder addGlossaryTranslations( + int index, com.google.cloud.translate.v3.Translation value) { + if (glossaryTranslationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGlossaryTranslationsIsMutable(); + glossaryTranslations_.add(index, value); + onChanged(); + } else { + glossaryTranslationsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder addGlossaryTranslations( + com.google.cloud.translate.v3.Translation.Builder builderForValue) { + if (glossaryTranslationsBuilder_ == null) { + ensureGlossaryTranslationsIsMutable(); + glossaryTranslations_.add(builderForValue.build()); + onChanged(); + } else { + glossaryTranslationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder addGlossaryTranslations( + int index, com.google.cloud.translate.v3.Translation.Builder builderForValue) { + if (glossaryTranslationsBuilder_ == null) { + ensureGlossaryTranslationsIsMutable(); + glossaryTranslations_.add(index, builderForValue.build()); + onChanged(); + } else { + glossaryTranslationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder addAllGlossaryTranslations( + java.lang.Iterable values) { + if (glossaryTranslationsBuilder_ == null) { + ensureGlossaryTranslationsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, glossaryTranslations_); + onChanged(); + } else { + glossaryTranslationsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder clearGlossaryTranslations() { + if (glossaryTranslationsBuilder_ == null) { + glossaryTranslations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + glossaryTranslationsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public Builder removeGlossaryTranslations(int index) { + if (glossaryTranslationsBuilder_ == null) { + ensureGlossaryTranslationsIsMutable(); + glossaryTranslations_.remove(index); + onChanged(); + } else { + glossaryTranslationsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public com.google.cloud.translate.v3.Translation.Builder getGlossaryTranslationsBuilder( + int index) { + return getGlossaryTranslationsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public com.google.cloud.translate.v3.TranslationOrBuilder getGlossaryTranslationsOrBuilder( + int index) { + if (glossaryTranslationsBuilder_ == null) { + return glossaryTranslations_.get(index); + } else { + return glossaryTranslationsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public java.util.List + getGlossaryTranslationsOrBuilderList() { + if (glossaryTranslationsBuilder_ != null) { + return glossaryTranslationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(glossaryTranslations_); + } + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public com.google.cloud.translate.v3.Translation.Builder addGlossaryTranslationsBuilder() { + return getGlossaryTranslationsFieldBuilder() + .addBuilder(com.google.cloud.translate.v3.Translation.getDefaultInstance()); + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public com.google.cloud.translate.v3.Translation.Builder addGlossaryTranslationsBuilder( + int index) { + return getGlossaryTranslationsFieldBuilder() + .addBuilder(index, com.google.cloud.translate.v3.Translation.getDefaultInstance()); + } + /** + * + * + *
+     * Text translation responses if a glossary is provided in the request.
+     * This can be the same as
+     * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+     * if no terms apply. This field has the same length as
+     * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+     * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + public java.util.List + getGlossaryTranslationsBuilderList() { + return getGlossaryTranslationsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Translation, + com.google.cloud.translate.v3.Translation.Builder, + com.google.cloud.translate.v3.TranslationOrBuilder> + getGlossaryTranslationsFieldBuilder() { + if (glossaryTranslationsBuilder_ == null) { + glossaryTranslationsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.translate.v3.Translation, + com.google.cloud.translate.v3.Translation.Builder, + com.google.cloud.translate.v3.TranslationOrBuilder>( + glossaryTranslations_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + glossaryTranslations_ = null; + } + return glossaryTranslationsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.TranslateTextResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.TranslateTextResponse) + private static final com.google.cloud.translate.v3.TranslateTextResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.TranslateTextResponse(); + } + + public static com.google.cloud.translate.v3.TranslateTextResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TranslateTextResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TranslateTextResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.TranslateTextResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextResponseOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextResponseOrBuilder.java new file mode 100644 index 00000000..52487a62 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslateTextResponseOrBuilder.java @@ -0,0 +1,159 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface TranslateTextResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.TranslateTextResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + java.util.List getTranslationsList(); + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + com.google.cloud.translate.v3.Translation getTranslations(int index); + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + int getTranslationsCount(); + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + java.util.List + getTranslationsOrBuilderList(); + /** + * + * + *
+   * Text translation responses with no glossary applied.
+   * This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation translations = 1; + */ + com.google.cloud.translate.v3.TranslationOrBuilder getTranslationsOrBuilder(int index); + + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + java.util.List getGlossaryTranslationsList(); + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + com.google.cloud.translate.v3.Translation getGlossaryTranslations(int index); + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + int getGlossaryTranslationsCount(); + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + java.util.List + getGlossaryTranslationsOrBuilderList(); + /** + * + * + *
+   * Text translation responses if a glossary is provided in the request.
+   * This can be the same as
+   * [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations]
+   * if no terms apply. This field has the same length as
+   * [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents].
+   * 
+ * + * repeated .google.cloud.translation.v3.Translation glossary_translations = 3; + */ + com.google.cloud.translate.v3.TranslationOrBuilder getGlossaryTranslationsOrBuilder(int index); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/Translation.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/Translation.java new file mode 100644 index 00000000..165cbebd --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/Translation.java @@ -0,0 +1,1269 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +/** + * + * + *
+ * A single translation response.
+ * 
+ * + * Protobuf type {@code google.cloud.translation.v3.Translation} + */ +public final class Translation extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.Translation) + TranslationOrBuilder { + private static final long serialVersionUID = 0L; + // Use Translation.newBuilder() to construct. + private Translation(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Translation() { + translatedText_ = ""; + model_ = ""; + detectedLanguageCode_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Translation( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + translatedText_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + model_ = s; + break; + } + case 26: + { + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder subBuilder = null; + if (glossaryConfig_ != null) { + subBuilder = glossaryConfig_.toBuilder(); + } + glossaryConfig_ = + input.readMessage( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(glossaryConfig_); + glossaryConfig_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + detectedLanguageCode_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Translation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Translation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.Translation.class, + com.google.cloud.translate.v3.Translation.Builder.class); + } + + public static final int TRANSLATED_TEXT_FIELD_NUMBER = 1; + private volatile java.lang.Object translatedText_; + /** + * + * + *
+   * Text translated into the target language.
+   * 
+ * + * string translated_text = 1; + */ + public java.lang.String getTranslatedText() { + java.lang.Object ref = translatedText_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + translatedText_ = s; + return s; + } + } + /** + * + * + *
+   * Text translated into the target language.
+   * 
+ * + * string translated_text = 1; + */ + public com.google.protobuf.ByteString getTranslatedTextBytes() { + java.lang.Object ref = translatedText_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + translatedText_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MODEL_FIELD_NUMBER = 2; + private volatile java.lang.Object model_; + /** + * + * + *
+   * Only present when `model` is present in the request.
+   * `model` here is normalized to have project number.
+   * For example:
+   * If the `model` requested in TranslationTextRequest is
+   * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+   * `model` here would be normalized to
+   * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+   * 
+ * + * string model = 2; + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } + } + /** + * + * + *
+   * Only present when `model` is present in the request.
+   * `model` here is normalized to have project number.
+   * For example:
+   * If the `model` requested in TranslationTextRequest is
+   * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+   * `model` here would be normalized to
+   * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+   * 
+ * + * string model = 2; + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DETECTED_LANGUAGE_CODE_FIELD_NUMBER = 4; + private volatile java.lang.Object detectedLanguageCode_; + /** + * + * + *
+   * The BCP-47 language code of source text in the initial request, detected
+   * automatically, if no source language was passed within the initial
+   * request. If the source language was passed, auto-detection of the language
+   * does not occur and this field is empty.
+   * 
+ * + * string detected_language_code = 4; + */ + public java.lang.String getDetectedLanguageCode() { + java.lang.Object ref = detectedLanguageCode_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + detectedLanguageCode_ = s; + return s; + } + } + /** + * + * + *
+   * The BCP-47 language code of source text in the initial request, detected
+   * automatically, if no source language was passed within the initial
+   * request. If the source language was passed, auto-detection of the language
+   * does not occur and this field is empty.
+   * 
+ * + * string detected_language_code = 4; + */ + public com.google.protobuf.ByteString getDetectedLanguageCodeBytes() { + java.lang.Object ref = detectedLanguageCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + detectedLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GLOSSARY_CONFIG_FIELD_NUMBER = 3; + private com.google.cloud.translate.v3.TranslateTextGlossaryConfig glossaryConfig_; + /** + * + * + *
+   * The `glossary_config` used for this translation.
+   * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public boolean hasGlossaryConfig() { + return glossaryConfig_ != null; + } + /** + * + * + *
+   * The `glossary_config` used for this translation.
+   * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossaryConfig() { + return glossaryConfig_ == null + ? com.google.cloud.translate.v3.TranslateTextGlossaryConfig.getDefaultInstance() + : glossaryConfig_; + } + /** + * + * + *
+   * The `glossary_config` used for this translation.
+   * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder + getGlossaryConfigOrBuilder() { + return getGlossaryConfig(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getTranslatedTextBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, translatedText_); + } + if (!getModelBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, model_); + } + if (glossaryConfig_ != null) { + output.writeMessage(3, getGlossaryConfig()); + } + if (!getDetectedLanguageCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, detectedLanguageCode_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getTranslatedTextBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, translatedText_); + } + if (!getModelBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, model_); + } + if (glossaryConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getGlossaryConfig()); + } + if (!getDetectedLanguageCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, detectedLanguageCode_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.translate.v3.Translation)) { + return super.equals(obj); + } + com.google.cloud.translate.v3.Translation other = + (com.google.cloud.translate.v3.Translation) obj; + + if (!getTranslatedText().equals(other.getTranslatedText())) return false; + if (!getModel().equals(other.getModel())) return false; + if (!getDetectedLanguageCode().equals(other.getDetectedLanguageCode())) return false; + if (hasGlossaryConfig() != other.hasGlossaryConfig()) return false; + if (hasGlossaryConfig()) { + if (!getGlossaryConfig().equals(other.getGlossaryConfig())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TRANSLATED_TEXT_FIELD_NUMBER; + hash = (53 * hash) + getTranslatedText().hashCode(); + hash = (37 * hash) + MODEL_FIELD_NUMBER; + hash = (53 * hash) + getModel().hashCode(); + hash = (37 * hash) + DETECTED_LANGUAGE_CODE_FIELD_NUMBER; + hash = (53 * hash) + getDetectedLanguageCode().hashCode(); + if (hasGlossaryConfig()) { + hash = (37 * hash) + GLOSSARY_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getGlossaryConfig().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.translate.v3.Translation parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Translation parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Translation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Translation parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Translation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.translate.v3.Translation parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Translation parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Translation parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Translation parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Translation parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.translate.v3.Translation parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.translate.v3.Translation parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.translate.v3.Translation prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A single translation response.
+   * 
+ * + * Protobuf type {@code google.cloud.translation.v3.Translation} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.Translation) + com.google.cloud.translate.v3.TranslationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Translation_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Translation_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.translate.v3.Translation.class, + com.google.cloud.translate.v3.Translation.Builder.class); + } + + // Construct using com.google.cloud.translate.v3.Translation.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + translatedText_ = ""; + + model_ = ""; + + detectedLanguageCode_ = ""; + + if (glossaryConfigBuilder_ == null) { + glossaryConfig_ = null; + } else { + glossaryConfig_ = null; + glossaryConfigBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.translate.v3.TranslationServiceProto + .internal_static_google_cloud_translation_v3_Translation_descriptor; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Translation getDefaultInstanceForType() { + return com.google.cloud.translate.v3.Translation.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.translate.v3.Translation build() { + com.google.cloud.translate.v3.Translation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Translation buildPartial() { + com.google.cloud.translate.v3.Translation result = + new com.google.cloud.translate.v3.Translation(this); + result.translatedText_ = translatedText_; + result.model_ = model_; + result.detectedLanguageCode_ = detectedLanguageCode_; + if (glossaryConfigBuilder_ == null) { + result.glossaryConfig_ = glossaryConfig_; + } else { + result.glossaryConfig_ = glossaryConfigBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.translate.v3.Translation) { + return mergeFrom((com.google.cloud.translate.v3.Translation) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.translate.v3.Translation other) { + if (other == com.google.cloud.translate.v3.Translation.getDefaultInstance()) return this; + if (!other.getTranslatedText().isEmpty()) { + translatedText_ = other.translatedText_; + onChanged(); + } + if (!other.getModel().isEmpty()) { + model_ = other.model_; + onChanged(); + } + if (!other.getDetectedLanguageCode().isEmpty()) { + detectedLanguageCode_ = other.detectedLanguageCode_; + onChanged(); + } + if (other.hasGlossaryConfig()) { + mergeGlossaryConfig(other.getGlossaryConfig()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.translate.v3.Translation parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.translate.v3.Translation) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object translatedText_ = ""; + /** + * + * + *
+     * Text translated into the target language.
+     * 
+ * + * string translated_text = 1; + */ + public java.lang.String getTranslatedText() { + java.lang.Object ref = translatedText_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + translatedText_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Text translated into the target language.
+     * 
+ * + * string translated_text = 1; + */ + public com.google.protobuf.ByteString getTranslatedTextBytes() { + java.lang.Object ref = translatedText_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + translatedText_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Text translated into the target language.
+     * 
+ * + * string translated_text = 1; + */ + public Builder setTranslatedText(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + translatedText_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Text translated into the target language.
+     * 
+ * + * string translated_text = 1; + */ + public Builder clearTranslatedText() { + + translatedText_ = getDefaultInstance().getTranslatedText(); + onChanged(); + return this; + } + /** + * + * + *
+     * Text translated into the target language.
+     * 
+ * + * string translated_text = 1; + */ + public Builder setTranslatedTextBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + translatedText_ = value; + onChanged(); + return this; + } + + private java.lang.Object model_ = ""; + /** + * + * + *
+     * Only present when `model` is present in the request.
+     * `model` here is normalized to have project number.
+     * For example:
+     * If the `model` requested in TranslationTextRequest is
+     * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+     * `model` here would be normalized to
+     * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+     * 
+ * + * string model = 2; + */ + public java.lang.String getModel() { + java.lang.Object ref = model_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + model_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Only present when `model` is present in the request.
+     * `model` here is normalized to have project number.
+     * For example:
+     * If the `model` requested in TranslationTextRequest is
+     * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+     * `model` here would be normalized to
+     * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+     * 
+ * + * string model = 2; + */ + public com.google.protobuf.ByteString getModelBytes() { + java.lang.Object ref = model_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + model_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Only present when `model` is present in the request.
+     * `model` here is normalized to have project number.
+     * For example:
+     * If the `model` requested in TranslationTextRequest is
+     * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+     * `model` here would be normalized to
+     * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+     * 
+ * + * string model = 2; + */ + public Builder setModel(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + model_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Only present when `model` is present in the request.
+     * `model` here is normalized to have project number.
+     * For example:
+     * If the `model` requested in TranslationTextRequest is
+     * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+     * `model` here would be normalized to
+     * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+     * 
+ * + * string model = 2; + */ + public Builder clearModel() { + + model_ = getDefaultInstance().getModel(); + onChanged(); + return this; + } + /** + * + * + *
+     * Only present when `model` is present in the request.
+     * `model` here is normalized to have project number.
+     * For example:
+     * If the `model` requested in TranslationTextRequest is
+     * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+     * `model` here would be normalized to
+     * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+     * 
+ * + * string model = 2; + */ + public Builder setModelBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + model_ = value; + onChanged(); + return this; + } + + private java.lang.Object detectedLanguageCode_ = ""; + /** + * + * + *
+     * The BCP-47 language code of source text in the initial request, detected
+     * automatically, if no source language was passed within the initial
+     * request. If the source language was passed, auto-detection of the language
+     * does not occur and this field is empty.
+     * 
+ * + * string detected_language_code = 4; + */ + public java.lang.String getDetectedLanguageCode() { + java.lang.Object ref = detectedLanguageCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + detectedLanguageCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The BCP-47 language code of source text in the initial request, detected
+     * automatically, if no source language was passed within the initial
+     * request. If the source language was passed, auto-detection of the language
+     * does not occur and this field is empty.
+     * 
+ * + * string detected_language_code = 4; + */ + public com.google.protobuf.ByteString getDetectedLanguageCodeBytes() { + java.lang.Object ref = detectedLanguageCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + detectedLanguageCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The BCP-47 language code of source text in the initial request, detected
+     * automatically, if no source language was passed within the initial
+     * request. If the source language was passed, auto-detection of the language
+     * does not occur and this field is empty.
+     * 
+ * + * string detected_language_code = 4; + */ + public Builder setDetectedLanguageCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + detectedLanguageCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The BCP-47 language code of source text in the initial request, detected
+     * automatically, if no source language was passed within the initial
+     * request. If the source language was passed, auto-detection of the language
+     * does not occur and this field is empty.
+     * 
+ * + * string detected_language_code = 4; + */ + public Builder clearDetectedLanguageCode() { + + detectedLanguageCode_ = getDefaultInstance().getDetectedLanguageCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * The BCP-47 language code of source text in the initial request, detected
+     * automatically, if no source language was passed within the initial
+     * request. If the source language was passed, auto-detection of the language
+     * does not occur and this field is empty.
+     * 
+ * + * string detected_language_code = 4; + */ + public Builder setDetectedLanguageCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + detectedLanguageCode_ = value; + onChanged(); + return this; + } + + private com.google.cloud.translate.v3.TranslateTextGlossaryConfig glossaryConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.TranslateTextGlossaryConfig, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder, + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder> + glossaryConfigBuilder_; + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public boolean hasGlossaryConfig() { + return glossaryConfigBuilder_ != null || glossaryConfig_ != null; + } + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossaryConfig() { + if (glossaryConfigBuilder_ == null) { + return glossaryConfig_ == null + ? com.google.cloud.translate.v3.TranslateTextGlossaryConfig.getDefaultInstance() + : glossaryConfig_; + } else { + return glossaryConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public Builder setGlossaryConfig( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig value) { + if (glossaryConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + glossaryConfig_ = value; + onChanged(); + } else { + glossaryConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public Builder setGlossaryConfig( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder builderForValue) { + if (glossaryConfigBuilder_ == null) { + glossaryConfig_ = builderForValue.build(); + onChanged(); + } else { + glossaryConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public Builder mergeGlossaryConfig( + com.google.cloud.translate.v3.TranslateTextGlossaryConfig value) { + if (glossaryConfigBuilder_ == null) { + if (glossaryConfig_ != null) { + glossaryConfig_ = + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.newBuilder(glossaryConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + glossaryConfig_ = value; + } + onChanged(); + } else { + glossaryConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public Builder clearGlossaryConfig() { + if (glossaryConfigBuilder_ == null) { + glossaryConfig_ = null; + onChanged(); + } else { + glossaryConfig_ = null; + glossaryConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder + getGlossaryConfigBuilder() { + + onChanged(); + return getGlossaryConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + public com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder + getGlossaryConfigOrBuilder() { + if (glossaryConfigBuilder_ != null) { + return glossaryConfigBuilder_.getMessageOrBuilder(); + } else { + return glossaryConfig_ == null + ? com.google.cloud.translate.v3.TranslateTextGlossaryConfig.getDefaultInstance() + : glossaryConfig_; + } + } + /** + * + * + *
+     * The `glossary_config` used for this translation.
+     * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.TranslateTextGlossaryConfig, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder, + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder> + getGlossaryConfigFieldBuilder() { + if (glossaryConfigBuilder_ == null) { + glossaryConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.translate.v3.TranslateTextGlossaryConfig, + com.google.cloud.translate.v3.TranslateTextGlossaryConfig.Builder, + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder>( + getGlossaryConfig(), getParentForChildren(), isClean()); + glossaryConfig_ = null; + } + return glossaryConfigBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.Translation) + } + + // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.Translation) + private static final com.google.cloud.translate.v3.Translation DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.translate.v3.Translation(); + } + + public static com.google.cloud.translate.v3.Translation getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Translation parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Translation(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.translate.v3.Translation getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationOrBuilder.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationOrBuilder.java new file mode 100644 index 00000000..1aa2cfaa --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationOrBuilder.java @@ -0,0 +1,137 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public interface TranslationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.translation.v3.Translation) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Text translated into the target language.
+   * 
+ * + * string translated_text = 1; + */ + java.lang.String getTranslatedText(); + /** + * + * + *
+   * Text translated into the target language.
+   * 
+ * + * string translated_text = 1; + */ + com.google.protobuf.ByteString getTranslatedTextBytes(); + + /** + * + * + *
+   * Only present when `model` is present in the request.
+   * `model` here is normalized to have project number.
+   * For example:
+   * If the `model` requested in TranslationTextRequest is
+   * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+   * `model` here would be normalized to
+   * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+   * 
+ * + * string model = 2; + */ + java.lang.String getModel(); + /** + * + * + *
+   * Only present when `model` is present in the request.
+   * `model` here is normalized to have project number.
+   * For example:
+   * If the `model` requested in TranslationTextRequest is
+   * `projects/{project-id}/locations/{location-id}/models/general/nmt` then
+   * `model` here would be normalized to
+   * `projects/{project-number}/locations/{location-id}/models/general/nmt`.
+   * 
+ * + * string model = 2; + */ + com.google.protobuf.ByteString getModelBytes(); + + /** + * + * + *
+   * The BCP-47 language code of source text in the initial request, detected
+   * automatically, if no source language was passed within the initial
+   * request. If the source language was passed, auto-detection of the language
+   * does not occur and this field is empty.
+   * 
+ * + * string detected_language_code = 4; + */ + java.lang.String getDetectedLanguageCode(); + /** + * + * + *
+   * The BCP-47 language code of source text in the initial request, detected
+   * automatically, if no source language was passed within the initial
+   * request. If the source language was passed, auto-detection of the language
+   * does not occur and this field is empty.
+   * 
+ * + * string detected_language_code = 4; + */ + com.google.protobuf.ByteString getDetectedLanguageCodeBytes(); + + /** + * + * + *
+   * The `glossary_config` used for this translation.
+   * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + boolean hasGlossaryConfig(); + /** + * + * + *
+   * The `glossary_config` used for this translation.
+   * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + com.google.cloud.translate.v3.TranslateTextGlossaryConfig getGlossaryConfig(); + /** + * + * + *
+   * The `glossary_config` used for this translation.
+   * 
+ * + * .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3; + */ + com.google.cloud.translate.v3.TranslateTextGlossaryConfigOrBuilder getGlossaryConfigOrBuilder(); +} diff --git a/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationServiceProto.java b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationServiceProto.java new file mode 100644 index 00000000..bda51bf0 --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/java/com/google/cloud/translate/v3/TranslationServiceProto.java @@ -0,0 +1,718 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/translate/v3/translation_service.proto + +package com.google.cloud.translate.v3; + +public final class TranslationServiceProto { + private TranslationServiceProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_TranslateTextRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_TranslateTextRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_TranslateTextRequest_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_TranslateTextRequest_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_TranslateTextResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_TranslateTextResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_Translation_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_Translation_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_DetectLanguageRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_DetectLanguageRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_DetectLanguageRequest_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_DetectLanguageRequest_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_DetectedLanguage_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_DetectedLanguage_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_DetectLanguageResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_DetectLanguageResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_SupportedLanguages_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_SupportedLanguages_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_SupportedLanguage_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_SupportedLanguage_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_GcsSource_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_GcsSource_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_InputConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_InputConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_GcsDestination_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_GcsDestination_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_OutputConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_OutputConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_ModelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_ModelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_GlossariesEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_GlossariesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_BatchTranslateMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_BatchTranslateMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_BatchTranslateResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_BatchTranslateResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_GlossaryInputConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_GlossaryInputConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_Glossary_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_Glossary_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_CreateGlossaryRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_CreateGlossaryRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_GetGlossaryRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_GetGlossaryRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_ListGlossariesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_ListGlossariesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_ListGlossariesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_ListGlossariesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n3google/cloud/translate/v3/translation_" + + "service.proto\022\033google.cloud.translation." + + "v3\032\034google/api/annotations.proto\032\027google" + + "/api/client.proto\032\037google/api/field_beha" + + "vior.proto\032\031google/api/resource.proto\032#g" + + "oogle/longrunning/operations.proto\032\037goog" + + "le/protobuf/timestamp.proto\"N\n\033Translate" + + "TextGlossaryConfig\022\025\n\010glossary\030\001 \001(\tB\003\340A" + + "\002\022\030\n\013ignore_case\030\002 \001(\010B\003\340A\001\"\265\003\n\024Translat" + + "eTextRequest\022\025\n\010contents\030\001 \003(\tB\003\340A\002\022\026\n\tm" + + "ime_type\030\003 \001(\tB\003\340A\001\022!\n\024source_language_c" + + "ode\030\004 \001(\tB\003\340A\001\022!\n\024target_language_code\030\005" + + " \001(\tB\003\340A\002\0229\n\006parent\030\010 \001(\tB)\340A\002\372A#\n!locat" + + "ions.googleapis.com/Location\022\022\n\005model\030\006 " + + "\001(\tB\003\340A\001\022V\n\017glossary_config\030\007 \001(\01328.goog" + + "le.cloud.translation.v3.TranslateTextGlo" + + "ssaryConfigB\003\340A\001\022R\n\006labels\030\n \003(\0132=.googl" + + "e.cloud.translation.v3.TranslateTextRequ" + + "est.LabelsEntryB\003\340A\001\032-\n\013LabelsEntry\022\013\n\003k" + + "ey\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\240\001\n\025Translat" + + "eTextResponse\022>\n\014translations\030\001 \003(\0132(.go" + + "ogle.cloud.translation.v3.Translation\022G\n" + + "\025glossary_translations\030\003 \003(\0132(.google.cl" + + "oud.translation.v3.Translation\"\250\001\n\013Trans" + + "lation\022\027\n\017translated_text\030\001 \001(\t\022\r\n\005model" + + "\030\002 \001(\t\022\036\n\026detected_language_code\030\004 \001(\t\022Q" + + "\n\017glossary_config\030\003 \001(\01328.google.cloud.t" + + "ranslation.v3.TranslateTextGlossaryConfi" + + "g\"\237\002\n\025DetectLanguageRequest\0229\n\006parent\030\005 " + + "\001(\tB)\340A\002\372A#\n!locations.googleapis.com/Lo" + + "cation\022\022\n\005model\030\004 \001(\tB\003\340A\001\022\021\n\007content\030\001 " + + "\001(\tH\000\022\026\n\tmime_type\030\003 \001(\tB\003\340A\001\022S\n\006labels\030" + + "\006 \003(\0132>.google.cloud.translation.v3.Dete" + + "ctLanguageRequest.LabelsEntryB\003\340A\001\032-\n\013La" + + "belsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028" + + "\001B\010\n\006source\"=\n\020DetectedLanguage\022\025\n\rlangu" + + "age_code\030\001 \001(\t\022\022\n\nconfidence\030\002 \001(\002\"Z\n\026De" + + "tectLanguageResponse\022@\n\tlanguages\030\001 \003(\0132" + + "-.google.cloud.translation.v3.DetectedLa" + + "nguage\"\221\001\n\034GetSupportedLanguagesRequest\022" + + "9\n\006parent\030\003 \001(\tB)\340A\002\372A#\n!locations.googl" + + "eapis.com/Location\022\"\n\025display_language_c" + + "ode\030\001 \001(\tB\003\340A\001\022\022\n\005model\030\002 \001(\tB\003\340A\001\"W\n\022Su" + + "pportedLanguages\022A\n\tlanguages\030\001 \003(\0132..go" + + "ogle.cloud.translation.v3.SupportedLangu" + + "age\"p\n\021SupportedLanguage\022\025\n\rlanguage_cod" + + "e\030\001 \001(\t\022\024\n\014display_name\030\002 \001(\t\022\026\n\016support" + + "_source\030\003 \001(\010\022\026\n\016support_target\030\004 \001(\010\"\036\n" + + "\tGcsSource\022\021\n\tinput_uri\030\001 \001(\t\"m\n\013InputCo" + + "nfig\022\026\n\tmime_type\030\001 \001(\tB\003\340A\001\022<\n\ngcs_sour" + + "ce\030\002 \001(\0132&.google.cloud.translation.v3.G" + + "csSourceH\000B\010\n\006source\"+\n\016GcsDestination\022\031" + + "\n\021output_uri_prefix\030\001 \001(\t\"e\n\014OutputConfi" + + "g\022F\n\017gcs_destination\030\001 \001(\0132+.google.clou" + + "d.translation.v3.GcsDestinationH\000B\r\n\013des" + + "tination\"\210\006\n\031BatchTranslateTextRequest\0229" + + "\n\006parent\030\001 \001(\tB)\340A\002\372A#\n!locations.google" + + "apis.com/Location\022!\n\024source_language_cod" + + "e\030\002 \001(\tB\003\340A\002\022\"\n\025target_language_codes\030\003 " + + "\003(\tB\003\340A\002\022W\n\006models\030\004 \003(\0132B.google.cloud." + + "translation.v3.BatchTranslateTextRequest" + + ".ModelsEntryB\003\340A\001\022D\n\rinput_configs\030\005 \003(\013" + + "2(.google.cloud.translation.v3.InputConf" + + "igB\003\340A\002\022E\n\routput_config\030\006 \001(\0132).google." + + "cloud.translation.v3.OutputConfigB\003\340A\002\022_" + + "\n\nglossaries\030\007 \003(\0132F.google.cloud.transl" + + "ation.v3.BatchTranslateTextRequest.Gloss" + + "ariesEntryB\003\340A\001\022W\n\006labels\030\t \003(\0132B.google" + + ".cloud.translation.v3.BatchTranslateText" + + "Request.LabelsEntryB\003\340A\001\032-\n\013ModelsEntry\022" + + "\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\032k\n\017Gloss" + + "ariesEntry\022\013\n\003key\030\001 \001(\t\022G\n\005value\030\002 \001(\01328" + + ".google.cloud.translation.v3.TranslateTe" + + "xtGlossaryConfig:\0028\001\032-\n\013LabelsEntry\022\013\n\003k" + + "ey\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\316\002\n\026BatchTra" + + "nslateMetadata\022H\n\005state\030\001 \001(\01629.google.c" + + "loud.translation.v3.BatchTranslateMetada" + + "ta.State\022\035\n\025translated_characters\030\002 \001(\003\022" + + "\031\n\021failed_characters\030\003 \001(\003\022\030\n\020total_char" + + "acters\030\004 \001(\003\022/\n\013submit_time\030\005 \001(\0132\032.goog" + + "le.protobuf.Timestamp\"e\n\005State\022\025\n\021STATE_" + + "UNSPECIFIED\020\000\022\013\n\007RUNNING\020\001\022\r\n\tSUCCEEDED\020" + + "\002\022\n\n\006FAILED\020\003\022\016\n\nCANCELLING\020\004\022\r\n\tCANCELL" + + "ED\020\005\"\313\001\n\026BatchTranslateResponse\022\030\n\020total" + + "_characters\030\001 \001(\003\022\035\n\025translated_characte" + + "rs\030\002 \001(\003\022\031\n\021failed_characters\030\003 \001(\003\022/\n\013s" + + "ubmit_time\030\004 \001(\0132\032.google.protobuf.Times" + + "tamp\022,\n\010end_time\030\005 \001(\0132\032.google.protobuf" + + ".Timestamp\"]\n\023GlossaryInputConfig\022<\n\ngcs" + + "_source\030\001 \001(\0132&.google.cloud.translation" + + ".v3.GcsSourceH\000B\010\n\006source\"\372\004\n\010Glossary\022\014" + + "\n\004name\030\001 \001(\t\022O\n\rlanguage_pair\030\003 \001(\01326.go" + + "ogle.cloud.translation.v3.Glossary.Langu" + + "ageCodePairH\000\022T\n\022language_codes_set\030\004 \001(" + + "\01326.google.cloud.translation.v3.Glossary" + + ".LanguageCodesSetH\000\022F\n\014input_config\030\005 \001(" + + "\01320.google.cloud.translation.v3.Glossary" + + "InputConfig\022\030\n\013entry_count\030\006 \001(\005B\003\340A\003\0224\n" + + "\013submit_time\030\007 \001(\0132\032.google.protobuf.Tim" + + "estampB\003\340A\003\0221\n\010end_time\030\010 \001(\0132\032.google.p" + + "rotobuf.TimestampB\003\340A\003\032N\n\020LanguageCodePa" + + "ir\022\034\n\024source_language_code\030\001 \001(\t\022\034\n\024targ" + + "et_language_code\030\002 \001(\t\032*\n\020LanguageCodesS" + + "et\022\026\n\016language_codes\030\001 \003(\t:e\352Ab\n!transla" + + "te.googleapis.com/Glossary\022=projects/{pr" + + "oject}/locations/{location}/glossaries/{" + + "glossary}B\013\n\tlanguages\"\220\001\n\025CreateGlossar" + + "yRequest\0229\n\006parent\030\001 \001(\tB)\340A\002\372A#\n!locati" + + "ons.googleapis.com/Location\022<\n\010glossary\030" + + "\002 \001(\0132%.google.cloud.translation.v3.Glos" + + "saryB\003\340A\002\"M\n\022GetGlossaryRequest\0227\n\004name\030" + + "\001 \001(\tB)\340A\002\372A#\n!translate.googleapis.com/" + + "Glossary\"P\n\025DeleteGlossaryRequest\0227\n\004nam" + + "e\030\001 \001(\tB)\340A\002\372A#\n!translate.googleapis.co" + + "m/Glossary\"\230\001\n\025ListGlossariesRequest\0229\n\006" + + "parent\030\001 \001(\tB)\340A\002\372A#\n!locations.googleap" + + "is.com/Location\022\026\n\tpage_size\030\002 \001(\005B\003\340A\001\022" + + "\027\n\npage_token\030\003 \001(\tB\003\340A\001\022\023\n\006filter\030\004 \001(\t" + + "B\003\340A\001\"l\n\026ListGlossariesResponse\0229\n\ngloss" + + "aries\030\001 \003(\0132%.google.cloud.translation.v" + + "3.Glossary\022\027\n\017next_page_token\030\002 \001(\t\"\210\002\n\026" + + "CreateGlossaryMetadata\022\014\n\004name\030\001 \001(\t\022H\n\005" + + "state\030\002 \001(\01629.google.cloud.translation.v" + + "3.CreateGlossaryMetadata.State\022/\n\013submit" + + "_time\030\003 \001(\0132\032.google.protobuf.Timestamp\"" + + "e\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\013\n\007RUNNI" + + "NG\020\001\022\r\n\tSUCCEEDED\020\002\022\n\n\006FAILED\020\003\022\016\n\nCANCE" + + "LLING\020\004\022\r\n\tCANCELLED\020\005\"\210\002\n\026DeleteGlossar" + + "yMetadata\022\014\n\004name\030\001 \001(\t\022H\n\005state\030\002 \001(\01629" + + ".google.cloud.translation.v3.DeleteGloss" + + "aryMetadata.State\022/\n\013submit_time\030\003 \001(\0132\032" + + ".google.protobuf.Timestamp\"e\n\005State\022\025\n\021S" + + "TATE_UNSPECIFIED\020\000\022\013\n\007RUNNING\020\001\022\r\n\tSUCCE" + + "EDED\020\002\022\n\n\006FAILED\020\003\022\016\n\nCANCELLING\020\004\022\r\n\tCA" + + "NCELLED\020\005\"\205\001\n\026DeleteGlossaryResponse\022\014\n\004" + + "name\030\001 \001(\t\022/\n\013submit_time\030\002 \001(\0132\032.google" + + ".protobuf.Timestamp\022,\n\010end_time\030\003 \001(\0132\032." + + "google.protobuf.Timestamp2\216\020\n\022Translatio" + + "nService\022\324\002\n\rTranslateText\0221.google.clou" + + "d.translation.v3.TranslateTextRequest\0322." + + "google.cloud.translation.v3.TranslateTex" + + "tResponse\"\333\001\202\323\344\223\002b\"1/v3/{parent=projects" + + "/*/locations/*}:translateText:\001*Z*\"%/v3/" + + "{parent=projects/*}:translateText:\001*\332A$p" + + "arent,target_language_code,contents\332AIpa" + + "rent,model,mime_type,source_language_cod" + + "e,target_language_code,contents\022\207\002\n\016Dete" + + "ctLanguage\0222.google.cloud.translation.v3" + + ".DetectLanguageRequest\0323.google.cloud.tr" + + "anslation.v3.DetectLanguageResponse\"\213\001\202\323" + + "\344\223\002d\"2/v3/{parent=projects/*/locations/*" + + "}:detectLanguage:\001*Z+\"&/v3/{parent=proje" + + "cts/*}:detectLanguage:\001*\332A\036parent,model," + + "mime_type,content\022\227\002\n\025GetSupportedLangua" + + "ges\0229.google.cloud.translation.v3.GetSup" + + "portedLanguagesRequest\032/.google.cloud.tr" + + "anslation.v3.SupportedLanguages\"\221\001\202\323\344\223\002f" + + "\0226/v3/{parent=projects/*/locations/*}/su" + + "pportedLanguagesZ,\022*/v3/{parent=projects" + + "/*}/supportedLanguages\332A\"parent,model,di" + + "splay_language_code\022\341\001\n\022BatchTranslateTe" + + "xt\0226.google.cloud.translation.v3.BatchTr" + + "anslateTextRequest\032\035.google.longrunning." + + "Operation\"t\202\323\344\223\002;\"6/v3/{parent=projects/" + + "*/locations/*}:batchTranslateText:\001*\312A0\n" + + "\026BatchTranslateResponse\022\026BatchTranslateM" + + "etadata\022\334\001\n\016CreateGlossary\0222.google.clou" + + "d.translation.v3.CreateGlossaryRequest\032\035" + + ".google.longrunning.Operation\"w\202\323\344\223\002:\"./" + + "v3/{parent=projects/*/locations/*}/gloss" + + "aries:\010glossary\332A\017parent,glossary\312A\"\n\010Gl" + + "ossary\022\026CreateGlossaryMetadata\022\272\001\n\016ListG" + + "lossaries\0222.google.cloud.translation.v3." + + "ListGlossariesRequest\0323.google.cloud.tra" + + "nslation.v3.ListGlossariesResponse\"?\202\323\344\223" + + "\0020\022./v3/{parent=projects/*/locations/*}/" + + "glossaries\332A\006parent\022\244\001\n\013GetGlossary\022/.go" + + "ogle.cloud.translation.v3.GetGlossaryReq" + + "uest\032%.google.cloud.translation.v3.Gloss" + + "ary\"=\202\323\344\223\0020\022./v3/{name=projects/*/locati" + + "ons/*/glossaries/*}\332A\004name\022\325\001\n\016DeleteGlo" + + "ssary\0222.google.cloud.translation.v3.Dele" + + "teGlossaryRequest\032\035.google.longrunning.O" + + "peration\"p\202\323\344\223\0020*./v3/{name=projects/*/l" + + "ocations/*/glossaries/*}\332A\004name\312A0\n\026Dele" + + "teGlossaryResponse\022\026DeleteGlossaryMetada" + + "ta\032~\312A\030translate.googleapis.com\322A`https:" + + "//www.googleapis.com/auth/cloud-platform" + + ",https://www.googleapis.com/auth/cloud-t" + + "ranslationB\330\001\n\035com.google.cloud.translat" + + "e.v3B\027TranslationServiceProtoP\001ZBgoogle." + + "golang.org/genproto/googleapis/cloud/tra" + + "nslate/v3;translate\370\001\001\252\002\031Google.Cloud.Tr" + + "anslate.V3\312\002\031Google\\Cloud\\Translate\\V3\352\002" + + "\034Google::Cloud::Translate::V3b\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }, + assigner); + internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_TranslateTextGlossaryConfig_descriptor, + new java.lang.String[] { + "Glossary", "IgnoreCase", + }); + internal_static_google_cloud_translation_v3_TranslateTextRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_translation_v3_TranslateTextRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_TranslateTextRequest_descriptor, + new java.lang.String[] { + "Contents", + "MimeType", + "SourceLanguageCode", + "TargetLanguageCode", + "Parent", + "Model", + "GlossaryConfig", + "Labels", + }); + internal_static_google_cloud_translation_v3_TranslateTextRequest_LabelsEntry_descriptor = + internal_static_google_cloud_translation_v3_TranslateTextRequest_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_translation_v3_TranslateTextRequest_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_TranslateTextRequest_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_translation_v3_TranslateTextResponse_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_translation_v3_TranslateTextResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_TranslateTextResponse_descriptor, + new java.lang.String[] { + "Translations", "GlossaryTranslations", + }); + internal_static_google_cloud_translation_v3_Translation_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_translation_v3_Translation_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_Translation_descriptor, + new java.lang.String[] { + "TranslatedText", "Model", "DetectedLanguageCode", "GlossaryConfig", + }); + internal_static_google_cloud_translation_v3_DetectLanguageRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_translation_v3_DetectLanguageRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_DetectLanguageRequest_descriptor, + new java.lang.String[] { + "Parent", "Model", "Content", "MimeType", "Labels", "Source", + }); + internal_static_google_cloud_translation_v3_DetectLanguageRequest_LabelsEntry_descriptor = + internal_static_google_cloud_translation_v3_DetectLanguageRequest_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_translation_v3_DetectLanguageRequest_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_DetectLanguageRequest_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_translation_v3_DetectedLanguage_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_translation_v3_DetectedLanguage_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_DetectedLanguage_descriptor, + new java.lang.String[] { + "LanguageCode", "Confidence", + }); + internal_static_google_cloud_translation_v3_DetectLanguageResponse_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_translation_v3_DetectLanguageResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_DetectLanguageResponse_descriptor, + new java.lang.String[] { + "Languages", + }); + internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_GetSupportedLanguagesRequest_descriptor, + new java.lang.String[] { + "Parent", "DisplayLanguageCode", "Model", + }); + internal_static_google_cloud_translation_v3_SupportedLanguages_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_translation_v3_SupportedLanguages_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_SupportedLanguages_descriptor, + new java.lang.String[] { + "Languages", + }); + internal_static_google_cloud_translation_v3_SupportedLanguage_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_translation_v3_SupportedLanguage_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_SupportedLanguage_descriptor, + new java.lang.String[] { + "LanguageCode", "DisplayName", "SupportSource", "SupportTarget", + }); + internal_static_google_cloud_translation_v3_GcsSource_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_cloud_translation_v3_GcsSource_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_GcsSource_descriptor, + new java.lang.String[] { + "InputUri", + }); + internal_static_google_cloud_translation_v3_InputConfig_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_google_cloud_translation_v3_InputConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_InputConfig_descriptor, + new java.lang.String[] { + "MimeType", "GcsSource", "Source", + }); + internal_static_google_cloud_translation_v3_GcsDestination_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_google_cloud_translation_v3_GcsDestination_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_GcsDestination_descriptor, + new java.lang.String[] { + "OutputUriPrefix", + }); + internal_static_google_cloud_translation_v3_OutputConfig_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_google_cloud_translation_v3_OutputConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_OutputConfig_descriptor, + new java.lang.String[] { + "GcsDestination", "Destination", + }); + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor = + getDescriptor().getMessageTypes().get(14); + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor, + new java.lang.String[] { + "Parent", + "SourceLanguageCode", + "TargetLanguageCodes", + "Models", + "InputConfigs", + "OutputConfig", + "Glossaries", + "Labels", + }); + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_ModelsEntry_descriptor = + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_ModelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_ModelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_GlossariesEntry_descriptor = + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor + .getNestedTypes() + .get(1); + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_GlossariesEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_GlossariesEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_LabelsEntry_descriptor = + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_descriptor + .getNestedTypes() + .get(2); + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_BatchTranslateTextRequest_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_translation_v3_BatchTranslateMetadata_descriptor = + getDescriptor().getMessageTypes().get(15); + internal_static_google_cloud_translation_v3_BatchTranslateMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_BatchTranslateMetadata_descriptor, + new java.lang.String[] { + "State", "TranslatedCharacters", "FailedCharacters", "TotalCharacters", "SubmitTime", + }); + internal_static_google_cloud_translation_v3_BatchTranslateResponse_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_google_cloud_translation_v3_BatchTranslateResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_BatchTranslateResponse_descriptor, + new java.lang.String[] { + "TotalCharacters", + "TranslatedCharacters", + "FailedCharacters", + "SubmitTime", + "EndTime", + }); + internal_static_google_cloud_translation_v3_GlossaryInputConfig_descriptor = + getDescriptor().getMessageTypes().get(17); + internal_static_google_cloud_translation_v3_GlossaryInputConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_GlossaryInputConfig_descriptor, + new java.lang.String[] { + "GcsSource", "Source", + }); + internal_static_google_cloud_translation_v3_Glossary_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_google_cloud_translation_v3_Glossary_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_Glossary_descriptor, + new java.lang.String[] { + "Name", + "LanguagePair", + "LanguageCodesSet", + "InputConfig", + "EntryCount", + "SubmitTime", + "EndTime", + "Languages", + }); + internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_descriptor = + internal_static_google_cloud_translation_v3_Glossary_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_Glossary_LanguageCodePair_descriptor, + new java.lang.String[] { + "SourceLanguageCode", "TargetLanguageCode", + }); + internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_descriptor = + internal_static_google_cloud_translation_v3_Glossary_descriptor.getNestedTypes().get(1); + internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_Glossary_LanguageCodesSet_descriptor, + new java.lang.String[] { + "LanguageCodes", + }); + internal_static_google_cloud_translation_v3_CreateGlossaryRequest_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_google_cloud_translation_v3_CreateGlossaryRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_CreateGlossaryRequest_descriptor, + new java.lang.String[] { + "Parent", "Glossary", + }); + internal_static_google_cloud_translation_v3_GetGlossaryRequest_descriptor = + getDescriptor().getMessageTypes().get(20); + internal_static_google_cloud_translation_v3_GetGlossaryRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_GetGlossaryRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_descriptor = + getDescriptor().getMessageTypes().get(21); + internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_DeleteGlossaryRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_translation_v3_ListGlossariesRequest_descriptor = + getDescriptor().getMessageTypes().get(22); + internal_static_google_cloud_translation_v3_ListGlossariesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_ListGlossariesRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", "Filter", + }); + internal_static_google_cloud_translation_v3_ListGlossariesResponse_descriptor = + getDescriptor().getMessageTypes().get(23); + internal_static_google_cloud_translation_v3_ListGlossariesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_ListGlossariesResponse_descriptor, + new java.lang.String[] { + "Glossaries", "NextPageToken", + }); + internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_descriptor = + getDescriptor().getMessageTypes().get(24); + internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_CreateGlossaryMetadata_descriptor, + new java.lang.String[] { + "Name", "State", "SubmitTime", + }); + internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_descriptor = + getDescriptor().getMessageTypes().get(25); + internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_DeleteGlossaryMetadata_descriptor, + new java.lang.String[] { + "Name", "State", "SubmitTime", + }); + internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_descriptor = + getDescriptor().getMessageTypes().get(26); + internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_translation_v3_DeleteGlossaryResponse_descriptor, + new java.lang.String[] { + "Name", "SubmitTime", "EndTime", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-translate-v3/src/main/proto/google/cloud/translate/v3/translation_service.proto b/proto-google-cloud-translate-v3/src/main/proto/google/cloud/translate/v3/translation_service.proto new file mode 100644 index 00000000..ad43831c --- /dev/null +++ b/proto-google-cloud-translate-v3/src/main/proto/google/cloud/translate/v3/translation_service.proto @@ -0,0 +1,926 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.translation.v3; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Translate.V3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/translate/v3;translate"; +option java_multiple_files = true; +option java_outer_classname = "TranslationServiceProto"; +option java_package = "com.google.cloud.translate.v3"; +option php_namespace = "Google\\Cloud\\Translate\\V3"; +option ruby_package = "Google::Cloud::Translate::V3"; + +// Proto file for the Cloud Translation API (v3 GA). + +// Provides natural language translation operations. +service TranslationService { + option (google.api.default_host) = "translate.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-translation"; + + // Translates input text and returns translated text. + rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:translateText" + body: "*" + additional_bindings { + post: "/v3/{parent=projects/*}:translateText" + body: "*" + } + }; + option (google.api.method_signature) = + "parent,target_language_code,contents"; + option (google.api.method_signature) = + "parent,model,mime_type,source_language_code,target_language_code,contents"; + } + + // Detects the language of text within a request. + rpc DetectLanguage(DetectLanguageRequest) returns (DetectLanguageResponse) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:detectLanguage" + body: "*" + additional_bindings { + post: "/v3/{parent=projects/*}:detectLanguage" + body: "*" + } + }; + option (google.api.method_signature) = "parent,model,mime_type,content"; + } + + // Returns a list of supported languages for translation. + rpc GetSupportedLanguages(GetSupportedLanguagesRequest) + returns (SupportedLanguages) { + option (google.api.http) = { + get: "/v3/{parent=projects/*/locations/*}/supportedLanguages" + additional_bindings { get: "/v3/{parent=projects/*}/supportedLanguages" } + }; + option (google.api.method_signature) = "parent,model,display_language_code"; + } + + // Translates a large volume of text in asynchronous batch mode. + // This function provides real-time output as the inputs are being processed. + // If caller cancels a request, the partial results (for an input file, it's + // all or nothing) may still be available on the specified output location. + // + // This call returns immediately and you can + // use google.longrunning.Operation.name to poll the status of the call. + rpc BatchTranslateText(BatchTranslateTextRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}:batchTranslateText" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "BatchTranslateResponse" + metadata_type: "BatchTranslateMetadata" + }; + } + + // Creates a glossary and returns the long-running operation. Returns + // NOT_FOUND, if the project doesn't exist. + rpc CreateGlossary(CreateGlossaryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v3/{parent=projects/*/locations/*}/glossaries" + body: "glossary" + }; + option (google.api.method_signature) = "parent,glossary"; + option (google.longrunning.operation_info) = { + response_type: "Glossary" + metadata_type: "CreateGlossaryMetadata" + }; + } + + // Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't + // exist. + rpc ListGlossaries(ListGlossariesRequest) returns (ListGlossariesResponse) { + option (google.api.http) = { + get: "/v3/{parent=projects/*/locations/*}/glossaries" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a glossary. Returns NOT_FOUND, if the glossary doesn't + // exist. + rpc GetGlossary(GetGlossaryRequest) returns (Glossary) { + option (google.api.http) = { + get: "/v3/{name=projects/*/locations/*/glossaries/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a glossary, or cancels glossary construction + // if the glossary isn't created yet. + // Returns NOT_FOUND, if the glossary doesn't exist. + rpc DeleteGlossary(DeleteGlossaryRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v3/{name=projects/*/locations/*/glossaries/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeleteGlossaryResponse" + metadata_type: "DeleteGlossaryMetadata" + }; + } +} + +// Configures which glossary should be used for a specific target language, +// and defines options for applying that glossary. +message TranslateTextGlossaryConfig { + // Required. Specifies the glossary used for this translation. Use + // this format: projects/*/locations/*/glossaries/* + string glossary = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates match is case-insensitive. + // Default value is false if missing. + bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for synchronous translation. +message TranslateTextRequest { + // Required. The content of the input in string format. + // We recommend the total content be less than 30k codepoints. + // Use BatchTranslateText for larger text. + repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The format of the source text, for example, "text/html", + // "text/plain". If left blank, the MIME type defaults to "text/html". + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The BCP-47 language code of the input text if + // known, for example, "en-US" or "sr-Latn". Supported language codes are + // listed in Language Support. If the source language isn't specified, the API + // attempts to identify the source language automatically and returns the + // source language within the response. + string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The BCP-47 language code to use for translation of the input + // text, set to one of the language codes listed in Language Support. + string target_language_code = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}` or + // `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for requests using AutoML models or + // custom glossaries. + // + // Models and glossaries must be within the same region (have same + // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 8 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The `model` type requested for this translation. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + // + // + // For global (non-regionalized) requests, use `location-id` `global`. + // For example, + // `projects/{project-number-or-id}/locations/global/models/general/nmt`. + // + // If missing, the system decides which google base model to use. + string model = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Glossary to be applied. The glossary must be + // within the same region (have the same location-id) as the model, otherwise + // an INVALID_ARGUMENT (400) error is returned. + TranslateTextGlossaryConfig glossary_config = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 10 [(google.api.field_behavior) = OPTIONAL]; +} + +message TranslateTextResponse { + // Text translation responses with no glossary applied. + // This field has the same length as + // [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + repeated Translation translations = 1; + + // Text translation responses if a glossary is provided in the request. + // This can be the same as + // [`translations`][google.cloud.translation.v3.TranslateTextResponse.translations] + // if no terms apply. This field has the same length as + // [`contents`][google.cloud.translation.v3.TranslateTextRequest.contents]. + repeated Translation glossary_translations = 3; +} + +// A single translation response. +message Translation { + // Text translated into the target language. + string translated_text = 1; + + // Only present when `model` is present in the request. + // `model` here is normalized to have project number. + // + // For example: + // If the `model` requested in TranslationTextRequest is + // `projects/{project-id}/locations/{location-id}/models/general/nmt` then + // `model` here would be normalized to + // `projects/{project-number}/locations/{location-id}/models/general/nmt`. + string model = 2; + + // The BCP-47 language code of source text in the initial request, detected + // automatically, if no source language was passed within the initial + // request. If the source language was passed, auto-detection of the language + // does not occur and this field is empty. + string detected_language_code = 4; + + // The `glossary_config` used for this translation. + TranslateTextGlossaryConfig glossary_config = 3; +} + +// The request message for language detection. +message DetectLanguageRequest { + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}` or + // `projects/{project-number-or-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Only models within the same region (has same location-id) can be used. + // Otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 5 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The language detection model to be used. + // + // Format: + // `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` + // + // Only one language detection model is currently supported: + // `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. + // + // If not specified, the default model is used. + string model = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The source of the document from which to detect the language. + oneof source { + // The content of the input stored as a string. + string content = 1; + } + + // Optional. The format of the source text, for example, "text/html", + // "text/plain". If left blank, the MIME type defaults to "text/html". + string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for language detection. +message DetectedLanguage { + // The BCP-47 language code of source content in the request, detected + // automatically. + string language_code = 1; + + // The confidence of the detection result for this language. + float confidence = 2; +} + +// The response message for language detection. +message DetectLanguageResponse { + // A list of detected languages sorted by detection confidence in descending + // order. The most probable language first. + repeated DetectedLanguage languages = 1; +} + +// The request message for discovering supported languages. +message GetSupportedLanguagesRequest { + // Required. Project or location to make a call. Must refer to a caller's + // project. + // + // Format: `projects/{project-number-or-id}` or + // `projects/{project-number-or-id}/locations/{location-id}`. + // + // For global calls, use `projects/{project-number-or-id}/locations/global` or + // `projects/{project-number-or-id}`. + // + // Non-global location is required for AutoML models. + // + // Only models within the same region (have same location-id) can be used, + // otherwise an INVALID_ARGUMENT (400) error is returned. + string parent = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The language to use to return localized, human readable names + // of supported languages. If missing, then display names are not returned + // in a response. + string display_language_code = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Get supported languages of this model. + // + // The format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + // + // + // Returns languages supported by the specified model. + // If missing, we get supported languages of Google general base (PBMT) model. + string model = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for discovering supported languages. +message SupportedLanguages { + // A list of supported language responses. This list contains an entry + // for each language the Translation API supports. + repeated SupportedLanguage languages = 1; +} + +// A single supported language response corresponds to information related +// to one supported language. +message SupportedLanguage { + // Supported language code, generally consisting of its ISO 639-1 + // identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes + // including language and region identifiers are returned (for example, + // 'zh-TW' and 'zh-CN') + string language_code = 1; + + // Human readable name of the language localized in the display language + // specified in the request. + string display_name = 2; + + // Can be used as source language. + bool support_source = 3; + + // Can be used as target language. + bool support_target = 4; +} + +// The Google Cloud Storage location for the input content. +message GcsSource { + // Required. Source data URI. For example, `gs://my_bucket/my_object`. + string input_uri = 1; +} + +// Input configuration for BatchTranslateText request. +message InputConfig { + // Optional. Can be "text/plain" or "text/html". + // For `.tsv`, "text/html" is used if mime_type is missing. + // For `.html`, this field must be "text/html" or empty. + // For `.txt`, this field must be "text/plain" or empty. + string mime_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Specify the input. + oneof source { + // Required. Google Cloud Storage location for the source input. + // This can be a single file (for example, + // `gs://translation-test/input.tsv`) or a wildcard (for example, + // `gs://translation-test/*`). If a file extension is `.tsv`, it can + // contain either one or two columns. The first column (optional) is the id + // of the text request. If the first column is missing, we use the row + // number (0-based) from the input file as the ID in the output file. The + // second column is the actual text to be + // translated. We recommend each row be <= 10K Unicode codepoints, + // otherwise an error might be returned. + // Note that the input tsv must be RFC 4180 compliant. + // + // You could use https://github.com/Clever/csvlint to check potential + // formatting errors in your tsv file. + // csvlint --delimiter='\t' your_input_file.tsv + // + // The other supported file extensions are `.txt` or `.html`, which is + // treated as a single large chunk of text. + GcsSource gcs_source = 2; + } +} + +// The Google Cloud Storage location for the output content. +message GcsDestination { + // Required. There must be no files under 'output_uri_prefix'. + // 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an + // INVALID_ARGUMENT (400) error is returned. + string output_uri_prefix = 1; +} + +// Output configuration for BatchTranslateText request. +message OutputConfig { + // Required. The destination of output. + oneof destination { + // Google Cloud Storage destination for output content. + // For every single input file (for example, gs://a/b/c.[extension]), we + // generate at most 2 * n output files. (n is the # of target_language_codes + // in the BatchTranslateTextRequest). + // + // Output files (tsv) generated are compliant with RFC 4180 except that + // record delimiters are '\n' instead of '\r\n'. We don't provide any way to + // change record delimiters. + // + // While the input files are being processed, we write/update an index file + // 'index.csv' under 'output_uri_prefix' (for example, + // gs://translation-test/index.csv) The index file is generated/updated as + // new files are being translated. The format is: + // + // input_file,target_language_code,translations_file,errors_file, + // glossary_translations_file,glossary_errors_file + // + // input_file is one file we matched using gcs_source.input_uri. + // target_language_code is provided in the request. + // translations_file contains the translations. (details provided below) + // errors_file contains the errors during processing of the file. (details + // below). Both translations_file and errors_file could be empty + // strings if we have no content to output. + // glossary_translations_file and glossary_errors_file are always empty + // strings if the input_file is tsv. They could also be empty if we have no + // content to output. + // + // Once a row is present in index.csv, the input/output matching never + // changes. Callers should also expect all the content in input_file are + // processed and ready to be consumed (that is, no partial output file is + // written). + // + // The format of translations_file (for target language code 'trg') is: + // gs://translation_test/a_b_c_'trg'_translations.[extension] + // + // If the input file extension is tsv, the output has the following + // columns: + // Column 1: ID of the request provided in the input, if it's not + // provided in the input, then the input row number is used (0-based). + // Column 2: source sentence. + // Column 3: translation without applying a glossary. Empty string if there + // is an error. + // Column 4 (only present if a glossary is provided in the request): + // translation after applying the glossary. Empty string if there is an + // error applying the glossary. Could be same string as column 3 if there is + // no glossary applied. + // + // If input file extension is a txt or html, the translation is directly + // written to the output file. If glossary is requested, a separate + // glossary_translations_file has format of + // gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] + // + // The format of errors file (for target language code 'trg') is: + // gs://translation_test/a_b_c_'trg'_errors.[extension] + // + // If the input file extension is tsv, errors_file contains the following: + // Column 1: ID of the request provided in the input, if it's not + // provided in the input, then the input row number is used (0-based). + // Column 2: source sentence. + // Column 3: Error detail for the translation. Could be empty. + // Column 4 (only present if a glossary is provided in the request): + // Error when applying the glossary. + // + // If the input file extension is txt or html, glossary_error_file will be + // generated that contains error details. glossary_error_file has format of + // gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] + GcsDestination gcs_destination = 1; + } +} + +// The batch translation request. +message BatchTranslateTextRequest { + // Required. Location to make a call. Must refer to a caller's project. + // + // Format: `projects/{project-number-or-id}/locations/{location-id}`. + // + // The `global` location is not supported for batch translation. + // + // Only AutoML Translation models or glossaries within the same region (have + // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) + // error is returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Source language code. + string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specify up to 10 language codes here. + repeated string target_language_codes = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. The models to use for translation. Map's key is target language + // code. Map's value is model name. Value can be a built-in general model, + // or an AutoML Translation model. + // + // The value format depends on model type: + // + // - AutoML Translation models: + // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` + // + // - General (built-in) models: + // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, + // `projects/{project-number-or-id}/locations/{location-id}/models/general/base` + // + // + // If the map is empty or a specific model is + // not requested for a language pair, then default google model (nmt) is used. + map models = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Input configurations. + // The total number of files matched should be <= 1000. + // The total content size should be <= 100M Unicode codepoints. + // The files must use UTF-8 encoding. + repeated InputConfig input_configs = 5 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Output configuration. + // If 2 input configs match to the same file (that is, same input path), + // we don't generate output for duplicate inputs. + OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Glossaries to be applied for translation. + // It's keyed by target language code. + map glossaries = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The labels with user-defined metadata for the request. + // + // Label keys and values can be no longer than 63 characters + // (Unicode codepoints), can only contain lowercase letters, numeric + // characters, underscores and dashes. International characters are allowed. + // Label values are optional. Label keys must start with a letter. + // + // See https://cloud.google.com/translate/docs/labels for more information. + map labels = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// State metadata for the batch translation operation. +message BatchTranslateMetadata { + // State of the job. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The batch is processed, and at least one item was successfully + // processed. + SUCCEEDED = 2; + + // The batch is done and no item was successfully processed. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The batch is done after the user has called the + // longrunning.Operations.CancelOperation. Any records processed before the + // cancel command are output as specified in the request. + CANCELLED = 5; + } + + // The state of the operation. + State state = 1; + + // Number of successfully translated characters so far (Unicode codepoints). + int64 translated_characters = 2; + + // Number of characters that have failed to process so far (Unicode + // codepoints). + int64 failed_characters = 3; + + // Total number of characters (Unicode codepoints). + // This is the total number of codepoints from input files times the number of + // target languages and appears here shortly after the call is submitted. + int64 total_characters = 4; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 5; +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by BatchTranslateText if at least one sentence is translated +// successfully. +message BatchTranslateResponse { + // Total number of characters (Unicode codepoints). + int64 total_characters = 1; + + // Number of successfully translated characters (Unicode codepoints). + int64 translated_characters = 2; + + // Number of characters that have failed to process (Unicode codepoints). + int64 failed_characters = 3; + + // Time when the operation was submitted. + google.protobuf.Timestamp submit_time = 4; + + // The time when the operation is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 5; +} + +// Input configuration for glossaries. +message GlossaryInputConfig { + // Required. Specify the input. + oneof source { + // Required. Google Cloud Storage location of glossary data. + // File format is determined based on the filename extension. API returns + // [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file + // formats. Wildcards are not allowed. This must be a single file in one of + // the following formats: + // + // For unidirectional glossaries: + // + // - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. + // The first column is source text. The second column is target text. + // The file must not contain headers. That is, the first row is data, not + // column names. + // + // - TMX (`.tmx`): TMX file with parallel data defining source/target term + // pairs. + // + // For equivalent term sets glossaries: + // + // - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms + // in multiple languages. The format is defined for Google Translation + // Toolkit and documented in [Use a + // glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en). + GcsSource gcs_source = 1; + } +} + +// Represents a glossary built from user provided data. +message Glossary { + option (google.api.resource) = { + type: "translate.googleapis.com/Glossary" + pattern: "projects/{project}/locations/{location}/glossaries/{glossary}" + }; + + // Used with unidirectional glossaries. + message LanguageCodePair { + // Required. The BCP-47 language code of the input text, for example, + // "en-US". Expected to be an exact match for GlossaryTerm.language_code. + string source_language_code = 1; + + // Required. The BCP-47 language code for translation output, for example, + // "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. + string target_language_code = 2; + } + + // Used with equivalent term set glossaries. + message LanguageCodesSet { + // The BCP-47 language code(s) for terms defined in the glossary. + // All entries are unique. The list contains at least two entries. + // Expected to be an exact match for GlossaryTerm.language_code. + repeated string language_codes = 1; + } + + // Required. The resource name of the glossary. Glossary names have the form + // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}`. + string name = 1; + + // Languages supported by the glossary. + oneof languages { + // Used with unidirectional glossaries. + LanguageCodePair language_pair = 3; + + // Used with equivalent term set glossaries. + LanguageCodesSet language_codes_set = 4; + } + + // Required. Provides examples to build the glossary from. + // Total glossary must not exceed 10M Unicode codepoints. + GlossaryInputConfig input_config = 5; + + // Output only. The number of entries defined in the glossary. + int32 entry_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When CreateGlossary was called. + google.protobuf.Timestamp submit_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. When the glossary creation was finished. + google.protobuf.Timestamp end_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for CreateGlossary. +message CreateGlossaryRequest { + // Required. The project name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The glossary to create. + Glossary glossary = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for GetGlossary. +message GetGlossaryRequest { + // Required. The name of the glossary to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; +} + +// Request message for DeleteGlossary. +message DeleteGlossaryRequest { + // Required. The name of the glossary to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "translate.googleapis.com/Glossary" + } + ]; +} + +// Request message for ListGlossaries. +message ListGlossariesRequest { + // Required. The name of the project from which to list all of the glossaries. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Requested page size. The server may return fewer glossaries than + // requested. If unspecified, the server picks an appropriate default. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A token identifying a page of results the server should return. + // Typically, this is the value of [ListGlossariesResponse.next_page_token] + // returned from the previous call to `ListGlossaries` method. + // The first page is returned if `page_token`is empty or missing. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filter specifying constraints of a list operation. + // Filtering is not supported yet, and the parameter currently has no effect. + // If missing, no filtering is performed. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListGlossaries. +message ListGlossariesResponse { + // The list of glossaries for a project. + repeated Glossary glossaries = 1; + + // A token to retrieve a page of results. Pass this value in the + // [ListGlossariesRequest.page_token] field in the subsequent call to + // `ListGlossaries` method to retrieve the next page of results. + string next_page_token = 2; +} + +// Stored in the +// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] +// field returned by CreateGlossary. +message CreateGlossaryMetadata { + // Enumerates the possible states that the creation request can be in. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The glossary was successfully created. + SUCCEEDED = 2; + + // Failed to create the glossary. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The glossary creation request was successfully canceled. + CANCELLED = 5; + } + + // The name of the glossary that is being created. + string name = 1; + + // The current state of the glossary creation operation. + State state = 2; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 3; +} + +// Stored in the +// [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] +// field returned by DeleteGlossary. +message DeleteGlossaryMetadata { + // Enumerates the possible states that the creation request can be in. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is being processed. + RUNNING = 1; + + // The glossary was successfully deleted. + SUCCEEDED = 2; + + // Failed to delete the glossary. + FAILED = 3; + + // Request is in the process of being canceled after caller invoked + // longrunning.Operations.CancelOperation on the request id. + CANCELLING = 4; + + // The glossary deletion request was successfully canceled. + CANCELLED = 5; + } + + // The name of the glossary that is being deleted. + string name = 1; + + // The current state of the glossary deletion operation. + State state = 2; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 3; +} + +// Stored in the +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field returned by DeleteGlossary. +message DeleteGlossaryResponse { + // The name of the deleted glossary. + string name = 1; + + // The time when the operation was submitted to the server. + google.protobuf.Timestamp submit_time = 2; + + // The time when the glossary deletion is finished and + // [google.longrunning.Operation.done][google.longrunning.Operation.done] is + // set to true. + google.protobuf.Timestamp end_time = 3; +} diff --git a/synth.metadata b/synth.metadata index bc0a87eb..4768ce96 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2019-10-01T21:50:19.303013Z", + "updateTime": "2019-10-01T23:07:24.196170Z", "sources": [ { "generator": { @@ -34,6 +34,16 @@ "generator": "gapic", "config": "google/cloud/translate/artman_translate_v3beta1.yaml" } + }, + { + "client": { + "source": "googleapis", + "apiName": "translate", + "apiVersion": "v3", + "language": "java", + "generator": "gapic", + "config": "google/cloud/translate/artman_translate_v3.yaml" + } } ] } \ No newline at end of file diff --git a/synth.py b/synth.py index 1f071671..09ba6971 100644 --- a/synth.py +++ b/synth.py @@ -21,7 +21,7 @@ gapic = gcp.GAPICGenerator() service = 'translate' -versions = ['v3beta1'] +versions = ['v3beta1', 'v3'] config_pattern = '/google/cloud/translate/artman_translate_{version}.yaml' for version in versions: diff --git a/versions.txt b/versions.txt index 06e229fc..c9161c04 100644 --- a/versions.txt +++ b/versions.txt @@ -2,5 +2,7 @@ # module:released-version:current-version proto-google-cloud-translate-v3beta1:0.76.1-SNAPSHOT:0.76.1-SNAPSHOT +proto-google-cloud-translate-v3:0.76.1-SNAPSHOT:0.76.1-SNAPSHOT grpc-google-cloud-translate-v3beta1:0.76.1-SNAPSHOT:0.76.1-SNAPSHOT +grpc-google-cloud-translate-v3:0.76.1-SNAPSHOT:0.76.1-SNAPSHOT google-cloud-translate:1.93.1-SNAPSHOT:1.93.1-SNAPSHOT \ No newline at end of file