Package com.google.cloud.translate.v3
Class Translation.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder
-
- com.google.protobuf.AbstractMessage.Builder<BuilderT>
-
- com.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
- com.google.cloud.translate.v3.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 typegoogle.cloud.translation.v3.Translation
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Translation.Builder
addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
Translation
build()
Translation
buildPartial()
Translation.Builder
clear()
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.Translation.Builder
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
Translation.Builder
clearGlossaryConfig()
The `glossary_config` used for this translation.Translation.Builder
clearModel()
Only present when `model` is present in the request.Translation.Builder
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
Translation.Builder
clearTranslatedText()
Text translated into the target language.Translation.Builder
clone()
Translation
getDefaultInstanceForType()
static com.google.protobuf.Descriptors.Descriptor
getDescriptor()
com.google.protobuf.Descriptors.Descriptor
getDescriptorForType()
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.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.TranslateTextGlossaryConfig
getGlossaryConfig()
The `glossary_config` used for this translation.TranslateTextGlossaryConfig.Builder
getGlossaryConfigBuilder()
The `glossary_config` used for this translation.TranslateTextGlossaryConfigOrBuilder
getGlossaryConfigOrBuilder()
The `glossary_config` used for this translation.String
getModel()
Only present when `model` is present in the request.com.google.protobuf.ByteString
getModelBytes()
Only present when `model` is present in the request.String
getTranslatedText()
Text translated into the target language.com.google.protobuf.ByteString
getTranslatedTextBytes()
Text translated into the target language.boolean
hasGlossaryConfig()
The `glossary_config` used for this translation.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()
boolean
isInitialized()
Translation.Builder
mergeFrom(Translation other)
Translation.Builder
mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
Translation.Builder
mergeFrom(com.google.protobuf.Message other)
Translation.Builder
mergeGlossaryConfig(TranslateTextGlossaryConfig value)
The `glossary_config` used for this translation.Translation.Builder
mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
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.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.Translation.Builder
setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
Translation.Builder
setGlossaryConfig(TranslateTextGlossaryConfig value)
The `glossary_config` used for this translation.Translation.Builder
setGlossaryConfig(TranslateTextGlossaryConfig.Builder builderForValue)
The `glossary_config` used for this translation.Translation.Builder
setModel(String value)
Only present when `model` is present in the request.Translation.Builder
setModelBytes(com.google.protobuf.ByteString value)
Only present when `model` is present in the request.Translation.Builder
setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
Translation.Builder
setTranslatedText(String value)
Text translated into the target language.Translation.Builder
setTranslatedTextBytes(com.google.protobuf.ByteString value)
Text translated into the target language.Translation.Builder
setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
-
Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3
-
Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
-
Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTable
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
clear
public Translation.Builder clear()
- Specified by:
clear
in interfacecom.google.protobuf.Message.Builder
- Specified by:
clear
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
clear
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.Message.Builder
- Specified by:
getDescriptorForType
in interfacecom.google.protobuf.MessageOrBuilder
- Overrides:
getDescriptorForType
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
getDefaultInstanceForType
public Translation getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Specified by:
getDefaultInstanceForType
in interfacecom.google.protobuf.MessageOrBuilder
-
build
public Translation build()
- Specified by:
build
in interfacecom.google.protobuf.Message.Builder
- Specified by:
build
in interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public Translation buildPartial()
- Specified by:
buildPartial
in interfacecom.google.protobuf.Message.Builder
- Specified by:
buildPartial
in interfacecom.google.protobuf.MessageLite.Builder
-
clone
public Translation.Builder clone()
- Specified by:
clone
in interfacecom.google.protobuf.Message.Builder
- Specified by:
clone
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
clone
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
setField
public Translation.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
- Specified by:
setField
in interfacecom.google.protobuf.Message.Builder
- Overrides:
setField
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
clearField
public Translation.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
- Specified by:
clearField
in interfacecom.google.protobuf.Message.Builder
- Overrides:
clearField
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
clearOneof
public Translation.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
- Specified by:
clearOneof
in interfacecom.google.protobuf.Message.Builder
- Overrides:
clearOneof
in classcom.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 interfacecom.google.protobuf.Message.Builder
- Overrides:
setRepeatedField
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
addRepeatedField
public Translation.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
- Specified by:
addRepeatedField
in interfacecom.google.protobuf.Message.Builder
- Overrides:
addRepeatedField
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
mergeFrom
public Translation.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFrom
in interfacecom.google.protobuf.Message.Builder
- Overrides:
mergeFrom
in classcom.google.protobuf.AbstractMessage.Builder<Translation.Builder>
-
mergeFrom
public Translation.Builder mergeFrom(Translation other)
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitialized
in interfacecom.google.protobuf.MessageLiteOrBuilder
- Overrides:
isInitialized
in classcom.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 interfacecom.google.protobuf.Message.Builder
- Specified by:
mergeFrom
in interfacecom.google.protobuf.MessageLite.Builder
- Overrides:
mergeFrom
in classcom.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 interfaceTranslationOrBuilder
- 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 interfaceTranslationOrBuilder
- 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 interfaceTranslationOrBuilder
- 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 interfaceTranslationOrBuilder
- 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 interfaceTranslationOrBuilder
- 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 interfaceTranslationOrBuilder
- 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 interfaceTranslationOrBuilder
- Returns:
- Whether the glossaryConfig field is set.
-
getGlossaryConfig
public TranslateTextGlossaryConfig getGlossaryConfig()
The `glossary_config` used for this translation.
.google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
- Specified by:
getGlossaryConfig
in interfaceTranslationOrBuilder
- Returns:
- The glossaryConfig.
-
setGlossaryConfig
public Translation.Builder setGlossaryConfig(TranslateTextGlossaryConfig value)
The `glossary_config` used for this translation.
.google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
-
setGlossaryConfig
public Translation.Builder setGlossaryConfig(TranslateTextGlossaryConfig.Builder builderForValue)
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;
-
getGlossaryConfigOrBuilder
public TranslateTextGlossaryConfigOrBuilder getGlossaryConfigOrBuilder()
The `glossary_config` used for this translation.
.google.cloud.translation.v3.TranslateTextGlossaryConfig glossary_config = 3;
- Specified by:
getGlossaryConfigOrBuilder
in interfaceTranslationOrBuilder
-
setUnknownFields
public final Translation.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
setUnknownFields
in interfacecom.google.protobuf.Message.Builder
- Overrides:
setUnknownFields
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
mergeUnknownFields
public final Translation.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
mergeUnknownFields
in interfacecom.google.protobuf.Message.Builder
- Overrides:
mergeUnknownFields
in classcom.google.protobuf.GeneratedMessageV3.Builder<Translation.Builder>
-
-