Class TranslateTextRequest.Builder (2.9.0)

Stay organized with collections Save and categorize content based on your preferences.
public static final class TranslateTextRequest.Builder extends GeneratedMessageV3.Builder<TranslateTextRequest.Builder> implements TranslateTextRequestOrBuilder

The request message for synchronous translation.

Protobuf type google.cloud.translation.v3beta1.TranslateTextRequest

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addAllContents(Iterable<String> values)

public TranslateTextRequest.Builder addAllContents(Iterable<String> values)

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. The max length of this field is 1024. Use BatchTranslateText for larger text.

repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valuesIterable<String>

The contents to add.

Returns
TypeDescription
TranslateTextRequest.Builder

This builder for chaining.

addContents(String value)

public TranslateTextRequest.Builder addContents(String value)

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. The max length of this field is 1024. Use BatchTranslateText for larger text.

repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueString

The contents to add.

Returns
TypeDescription
TranslateTextRequest.Builder

This builder for chaining.

addContentsBytes(ByteString value)

public TranslateTextRequest.Builder addContentsBytes(ByteString value)

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. The max length of this field is 1024. Use BatchTranslateText for larger text.

repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED];

Parameter
NameDescription
valueByteString

The bytes of the contents to add.

Returns
TypeDescription
TranslateTextRequest.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public TranslateTextRequest.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
TranslateTextRequest.Builder
Overrides

build()

public TranslateTextRequest build()
Returns
TypeDescription
TranslateTextRequest

buildPartial()

public TranslateTextRequest buildPartial()
Returns
TypeDescription
TranslateTextRequest

clear()

public TranslateTextRequest.Builder clear()
Returns
TypeDescription
TranslateTextRequest.Builder
Overrides

clearContents()

public TranslateTextRequest.Builder clearContents()

Required. The content of the input in string format. We recommend the total content be less than 30k codepoints. The max length of this field is 1024. Use BatchTranslateText for larger text.

repeated string contents = 1 [(.google.api.field_behavior) = REQUIRED];

Returns
TypeDescription
TranslateTextRequest.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public TranslateTextRequest.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
TranslateTextRequest.Builder
Overrides

clearGlossaryConfig()

public TranslateTextRequest.Builder clearGlossaryConfig()

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.v3beta1.TranslateTextGlossaryConfig glossary_config = 7 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
TranslateTextRequest.Builder

clearLabels()

public TranslateTextRequest.Builder clearLabels()
Returns
TypeDescription
TranslateTextRequest.Builder

clearMimeType()

public TranslateTextRequest.Builder clearMimeType()

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];

Returns
TypeDescription
TranslateTextRequest.Builder

This builder for chaining.

clearModel()

public TranslateTextRequest.Builder clearModel()

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];

Returns
TypeDescription
TranslateTextRequest.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public TranslateTextRequest.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
TranslateTextRequest.Builder
Overrides