Class TranslateTextRequest

  • All Implemented Interfaces:
    TranslateTextRequestOrBuilder, com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Serializable

    public final class TranslateTextRequest
    extends com.google.protobuf.GeneratedMessageV3
    implements TranslateTextRequestOrBuilder
     The request message for synchronous translation.
     
    Protobuf type google.cloud.translation.v3.TranslateTextRequest
    See Also:
    Serialized Form
    • Method Detail

      • newInstance

        protected Object newInstance​(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class com.google.protobuf.GeneratedMessageV3
      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetMapField

        protected com.google.protobuf.MapField internalGetMapField​(int number)
        Overrides:
        internalGetMapField in class com.google.protobuf.GeneratedMessageV3
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
      • getContentsList

        public com.google.protobuf.ProtocolStringList getContentsList()
         Required. The content of the input in string format.
         We recommend the total content be less than 30,000 codepoints. The max
         length of this field is 1024. Use BatchTranslateText for larger text.
         
        repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getContentsList in interface TranslateTextRequestOrBuilder
        Returns:
        A list containing the contents.
      • getContentsCount

        public int getContentsCount()
         Required. The content of the input in string format.
         We recommend the total content be less than 30,000 codepoints. The max
         length of this field is 1024. Use BatchTranslateText for larger text.
         
        repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getContentsCount in interface TranslateTextRequestOrBuilder
        Returns:
        The count of contents.
      • getContents

        public String getContents​(int index)
         Required. The content of the input in string format.
         We recommend the total content be less than 30,000 codepoints. The max
         length of this field is 1024. Use BatchTranslateText for larger text.
         
        repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getContents in interface TranslateTextRequestOrBuilder
        Parameters:
        index - The index of the element to return.
        Returns:
        The contents at the given index.
      • getContentsBytes

        public com.google.protobuf.ByteString getContentsBytes​(int index)
         Required. The content of the input in string format.
         We recommend the total content be less than 30,000 codepoints. The max
         length of this field is 1024. Use BatchTranslateText for larger text.
         
        repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getContentsBytes in interface TranslateTextRequestOrBuilder
        Parameters:
        index - The index of the value to return.
        Returns:
        The bytes of the contents at the given index.
      • getMimeType

        public 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];
        Specified by:
        getMimeType in interface TranslateTextRequestOrBuilder
        Returns:
        The mimeType.
      • getMimeTypeBytes

        public com.google.protobuf.ByteString getMimeTypeBytes()
         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];
        Specified by:
        getMimeTypeBytes in interface TranslateTextRequestOrBuilder
        Returns:
        The bytes for mimeType.
      • getSourceLanguageCode

        public String getSourceLanguageCode()
         Optional. The ISO-639 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];
        Specified by:
        getSourceLanguageCode in interface TranslateTextRequestOrBuilder
        Returns:
        The sourceLanguageCode.
      • getSourceLanguageCodeBytes

        public com.google.protobuf.ByteString getSourceLanguageCodeBytes()
         Optional. The ISO-639 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];
        Specified by:
        getSourceLanguageCodeBytes in interface TranslateTextRequestOrBuilder
        Returns:
        The bytes for sourceLanguageCode.
      • getTargetLanguageCode

        public String getTargetLanguageCode()
         Required. The ISO-639 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];
        Specified by:
        getTargetLanguageCode in interface TranslateTextRequestOrBuilder
        Returns:
        The targetLanguageCode.
      • getTargetLanguageCodeBytes

        public com.google.protobuf.ByteString getTargetLanguageCodeBytes()
         Required. The ISO-639 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];
        Specified by:
        getTargetLanguageCodeBytes in interface TranslateTextRequestOrBuilder
        Returns:
        The bytes for targetLanguageCode.
      • getParent

        public 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) = { ... }
        Specified by:
        getParent in interface TranslateTextRequestOrBuilder
        Returns:
        The parent.
      • getParentBytes

        public com.google.protobuf.ByteString getParentBytes()
         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) = { ... }
        Specified by:
        getParentBytes in interface TranslateTextRequestOrBuilder
        Returns:
        The bytes for parent.
      • getModel

        public 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`,
        
        
         For global (non-regionalized) requests, use `location-id` `global`.
         For example,
         `projects/{project-number-or-id}/locations/global/models/general/nmt`.
        
         If not provided, the default Google model (NMT) will be used
         
        string model = 6 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getModel in interface TranslateTextRequestOrBuilder
        Returns:
        The model.
      • getModelBytes

        public com.google.protobuf.ByteString getModelBytes()
         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`,
        
        
         For global (non-regionalized) requests, use `location-id` `global`.
         For example,
         `projects/{project-number-or-id}/locations/global/models/general/nmt`.
        
         If not provided, the default Google model (NMT) will be used
         
        string model = 6 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getModelBytes in interface TranslateTextRequestOrBuilder
        Returns:
        The bytes for model.
      • hasGlossaryConfig

        public 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];
        Specified by:
        hasGlossaryConfig in interface TranslateTextRequestOrBuilder
        Returns:
        Whether the glossaryConfig field is set.
      • getGlossaryConfig

        public 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];
        Specified by:
        getGlossaryConfig in interface TranslateTextRequestOrBuilder
        Returns:
        The glossaryConfig.
      • getGlossaryConfigOrBuilder

        public TranslateTextGlossaryConfigOrBuilder getGlossaryConfigOrBuilder()
         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];
        Specified by:
        getGlossaryConfigOrBuilder in interface TranslateTextRequestOrBuilder
      • getLabelsCount

        public int getLabelsCount()
        Description copied from interface: TranslateTextRequestOrBuilder
         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/advanced/labels for more
         information.
         
        map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getLabelsCount in interface TranslateTextRequestOrBuilder
      • containsLabels

        public boolean containsLabels​(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/advanced/labels for more
         information.
         
        map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        containsLabels in interface TranslateTextRequestOrBuilder
      • getLabelsMap

        public Map<String,​String> 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/advanced/labels for more
         information.
         
        map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getLabelsMap in interface TranslateTextRequestOrBuilder
      • getLabelsOrDefault

        public String getLabelsOrDefault​(String key,
                                         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/advanced/labels for more
         information.
         
        map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getLabelsOrDefault in interface TranslateTextRequestOrBuilder
      • getLabelsOrThrow

        public String getLabelsOrThrow​(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/advanced/labels for more
         information.
         
        map<string, string> labels = 10 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getLabelsOrThrow in interface TranslateTextRequestOrBuilder
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(com.google.protobuf.CodedOutputStream output)
                     throws IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessageV3
        Throws:
        IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface com.google.protobuf.MessageLite
        Overrides:
        getSerializedSize in class com.google.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface com.google.protobuf.Message
        Overrides:
        equals in class com.google.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface com.google.protobuf.Message
        Overrides:
        hashCode in class com.google.protobuf.AbstractMessage
      • parseFrom

        public static TranslateTextRequest parseFrom​(ByteBuffer data)
                                              throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TranslateTextRequest parseFrom​(ByteBuffer data,
                                                     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                              throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TranslateTextRequest parseFrom​(com.google.protobuf.ByteString data)
                                              throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TranslateTextRequest parseFrom​(com.google.protobuf.ByteString data,
                                                     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                              throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TranslateTextRequest parseFrom​(byte[] data)
                                              throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static TranslateTextRequest parseFrom​(byte[] data,
                                                     com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                              throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • newBuilderForType

        public TranslateTextRequest.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface com.google.protobuf.Message
        Specified by:
        newBuilderForType in interface com.google.protobuf.MessageLite
      • toBuilder

        public TranslateTextRequest.Builder toBuilder()
        Specified by:
        toBuilder in interface com.google.protobuf.Message
        Specified by:
        toBuilder in interface com.google.protobuf.MessageLite
      • newBuilderForType

        protected TranslateTextRequest.Builder newBuilderForType​(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class com.google.protobuf.GeneratedMessageV3
      • getParserForType

        public com.google.protobuf.Parser<TranslateTextRequest> getParserForType()
        Specified by:
        getParserForType in interface com.google.protobuf.Message
        Specified by:
        getParserForType in interface com.google.protobuf.MessageLite
        Overrides:
        getParserForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

        public TranslateTextRequest getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder