Class Translation.Builder

  • All Implemented Interfaces:
    TranslationOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
    Enclosing class:
    Translation

    public static final class Translation.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
    implements TranslationOrBuilder
     A single translation response.
     
    Protobuf type google.cloud.translation.v3.Translation
    • Method Detail

      • getDescriptor

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

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • clear

        public Translation.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • getDefaultInstanceForType

        public Translation getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public Translation build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public Translation buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public Translation.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • setField

        public Translation.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                            Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • clearField

        public Translation.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • clearOneof

        public Translation.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • setRepeatedField

        public Translation.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                    int index,
                                                    Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • addRepeatedField

        public Translation.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                    Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • mergeFrom

        public Translation.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<Translation.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • mergeFrom

        public Translation.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                      throws IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<Translation.Builder>
        Throws:
        IOException
      • getTranslatedText

        public String getTranslatedText()
         Text translated into the target language.
         If an error occurs during translation, this field might be excluded from
         the response.
         
        string translated_text = 1;
        Specified by:
        getTranslatedText in interface TranslationOrBuilder
        Returns:
        The translatedText.
      • getTranslatedTextBytes

        public com.google.protobuf.ByteString getTranslatedTextBytes()
         Text translated into the target language.
         If an error occurs during translation, this field might be excluded from
         the response.
         
        string translated_text = 1;
        Specified by:
        getTranslatedTextBytes in interface TranslationOrBuilder
        Returns:
        The bytes for translatedText.
      • setTranslatedText

        public Translation.Builder setTranslatedText​(String value)
         Text translated into the target language.
         If an error occurs during translation, this field might be excluded from
         the response.
         
        string translated_text = 1;
        Parameters:
        value - The translatedText to set.
        Returns:
        This builder for chaining.
      • clearTranslatedText

        public Translation.Builder clearTranslatedText()
         Text translated into the target language.
         If an error occurs during translation, this field might be excluded from
         the response.
         
        string translated_text = 1;
        Returns:
        This builder for chaining.
      • setTranslatedTextBytes

        public Translation.Builder setTranslatedTextBytes​(com.google.protobuf.ByteString value)
         Text translated into the target language.
         If an error occurs during translation, this field might be excluded from
         the response.
         
        string translated_text = 1;
        Parameters:
        value - The bytes for translatedText to set.
        Returns:
        This builder for chaining.
      • getModel

        public 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;
        Specified by:
        getModel in interface TranslationOrBuilder
        Returns:
        The model.
      • getModelBytes

        public com.google.protobuf.ByteString getModelBytes()
         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;
        Specified by:
        getModelBytes in interface TranslationOrBuilder
        Returns:
        The bytes for model.
      • setModel

        public Translation.Builder setModel​(String value)
         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;
        Parameters:
        value - The model to set.
        Returns:
        This builder for chaining.
      • clearModel

        public Translation.Builder clearModel()
         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;
        Returns:
        This builder for chaining.
      • setModelBytes

        public Translation.Builder setModelBytes​(com.google.protobuf.ByteString value)
         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;
        Parameters:
        value - The bytes for model to set.
        Returns:
        This builder for chaining.
      • getDetectedLanguageCode

        public String getDetectedLanguageCode()
         The ISO-639 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;
        Specified by:
        getDetectedLanguageCode in interface TranslationOrBuilder
        Returns:
        The detectedLanguageCode.
      • getDetectedLanguageCodeBytes

        public com.google.protobuf.ByteString getDetectedLanguageCodeBytes()
         The ISO-639 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;
        Specified by:
        getDetectedLanguageCodeBytes in interface TranslationOrBuilder
        Returns:
        The bytes for detectedLanguageCode.
      • setDetectedLanguageCode

        public Translation.Builder setDetectedLanguageCode​(String value)
         The ISO-639 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;
        Parameters:
        value - The detectedLanguageCode to set.
        Returns:
        This builder for chaining.
      • clearDetectedLanguageCode

        public Translation.Builder clearDetectedLanguageCode()
         The ISO-639 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;
        Returns:
        This builder for chaining.
      • setDetectedLanguageCodeBytes

        public Translation.Builder setDetectedLanguageCodeBytes​(com.google.protobuf.ByteString value)
         The ISO-639 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;
        Parameters:
        value - The bytes for detectedLanguageCode to set.
        Returns:
        This builder for chaining.
      • hasGlossaryConfig

        public boolean hasGlossaryConfig()
         The `glossary_config` used for this translation.
         
        .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
        Specified by:
        hasGlossaryConfig in interface TranslationOrBuilder
        Returns:
        Whether the glossaryConfig field is set.
      • setGlossaryConfig

        public Translation.Builder setGlossaryConfig​(TranslateTextGlossaryConfig value)
         The `glossary_config` used for this translation.
         
        .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
      • mergeGlossaryConfig

        public Translation.Builder mergeGlossaryConfig​(TranslateTextGlossaryConfig value)
         The `glossary_config` used for this translation.
         
        .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
      • clearGlossaryConfig

        public Translation.Builder clearGlossaryConfig()
         The `glossary_config` used for this translation.
         
        .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
      • getGlossaryConfigBuilder

        public TranslateTextGlossaryConfig.Builder getGlossaryConfigBuilder()
         The `glossary_config` used for this translation.
         
        .google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
      • setUnknownFields

        public final Translation.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
      • mergeUnknownFields

        public final Translation.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>