implements
// @@protoc_insertion_point(builder_implements:google.cloud.translation.v3beta1.Translation)
com.google.cloud.translate.v3beta1.TranslationOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.translate.v3beta1.TranslationServiceProto
.internal_static_google_cloud_translation_v3beta1_Translation_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.translate.v3beta1.TranslationServiceProto
.internal_static_google_cloud_translation_v3beta1_Translation_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.translate.v3beta1.Translation.class,
com.google.cloud.translate.v3beta1.Translation.Builder.class);
}
// Construct using com.google.cloud.translate.v3beta1.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) {
getGlossaryConfigFieldBuilder();
}
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
translatedText_ = "";
model_ = "";
detectedLanguageCode_ = "";
glossaryConfig_ = null;
if (glossaryConfigBuilder_ != null) {
glossaryConfigBuilder_.dispose();
glossaryConfigBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.cloud.translate.v3beta1.TranslationServiceProto
.internal_static_google_cloud_translation_v3beta1_Translation_descriptor;
}
@java.lang.Override
public com.google.cloud.translate.v3beta1.Translation getDefaultInstanceForType() {
return com.google.cloud.translate.v3beta1.Translation.getDefaultInstance();
}
@java.lang.Override
public com.google.cloud.translate.v3beta1.Translation build() {
com.google.cloud.translate.v3beta1.Translation result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.cloud.translate.v3beta1.Translation buildPartial() {
com.google.cloud.translate.v3beta1.Translation result =
new com.google.cloud.translate.v3beta1.Translation(this);
if (bitField0_ != 0) {
buildPartial0(result);
}
onBuilt();
return result;
}
private void buildPartial0(com.google.cloud.translate.v3beta1.Translation result) {
int from_bitField0_ = bitField0_;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.translatedText_ = translatedText_;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.model_ = model_;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.detectedLanguageCode_ = detectedLanguageCode_;
}
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000008) != 0)) {
result.glossaryConfig_ =
glossaryConfigBuilder_ == null ? glossaryConfig_ : glossaryConfigBuilder_.build();
to_bitField0_ |= 0x00000001;
}
result.bitField0_ |= to_bitField0_;
}
@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.v3beta1.Translation) {
return mergeFrom((com.google.cloud.translate.v3beta1.Translation) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.translate.v3beta1.Translation other) {
if (other == com.google.cloud.translate.v3beta1.Translation.getDefaultInstance()) return this;
if (!other.getTranslatedText().isEmpty()) {
translatedText_ = other.translatedText_;
bitField0_ |= 0x00000001;
onChanged();
}
if (!other.getModel().isEmpty()) {
model_ = other.model_;
bitField0_ |= 0x00000002;
onChanged();
}
if (!other.getDetectedLanguageCode().isEmpty()) {
detectedLanguageCode_ = other.detectedLanguageCode_;
bitField0_ |= 0x00000004;
onChanged();
}
if (other.hasGlossaryConfig()) {
mergeGlossaryConfig(other.getGlossaryConfig());
}
this.mergeUnknownFields(other.getUnknownFields());
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 {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10:
{
translatedText_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000001;
break;
} // case 10
case 18:
{
model_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000002;
break;
} // case 18
case 26:
{
input.readMessage(getGlossaryConfigFieldBuilder().getBuilder(), extensionRegistry);
bitField0_ |= 0x00000008;
break;
} // case 26
case 34:
{
detectedLanguageCode_ = input.readStringRequireUtf8();
bitField0_ |= 0x00000004;
break;
} // case 34
default:
{
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int bitField0_;
private java.lang.Object translatedText_ = "";
/**
*
*
*
* Text translated into the target language.
* If an error occurs during translation, this field might be excluded from
* the response.
*
*
* string translated_text = 1;
*
* @return The translatedText.
*/
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.
* If an error occurs during translation, this field might be excluded from
* the response.
*
*
* string translated_text = 1;
*
* @return The bytes for translatedText.
*/
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.
* If an error occurs during translation, this field might be excluded from
* the response.
*
*
* string translated_text = 1;
*
* @param value The translatedText to set.
* @return This builder for chaining.
*/
public Builder setTranslatedText(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
translatedText_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
*
*
* Text translated into the target language.
* If an error occurs during translation, this field might be excluded from
* the response.
*
*
* string translated_text = 1;
*
* @return This builder for chaining.
*/
public Builder clearTranslatedText() {
translatedText_ = getDefaultInstance().getTranslatedText();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
*
*
*
* Text translated into the target language.
* If an error occurs during translation, this field might be excluded from
* the response.
*
*
* string translated_text = 1;
*
* @param value The bytes for translatedText to set.
* @return This builder for chaining.
*/
public Builder setTranslatedTextBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
translatedText_ = value;
bitField0_ |= 0x00000001;
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;
*
* @return The model.
*/
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;
*
* @return The bytes for model.
*/
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;
*
* @param value The model to set.
* @return This builder for chaining.
*/
public Builder setModel(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
model_ = value;
bitField0_ |= 0x00000002;
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;
*
* @return This builder for chaining.
*/
public Builder clearModel() {
model_ = getDefaultInstance().getModel();
bitField0_ = (bitField0_ & ~0x00000002);
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;
*
* @param value The bytes for model to set.
* @return This builder for chaining.
*/
public Builder setModelBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
model_ = value;
bitField0_ |= 0x00000002;
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;
*
* @return The detectedLanguageCode.
*/
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;
*
* @return The bytes for detectedLanguageCode.
*/
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;
*
* @param value The detectedLanguageCode to set.
* @return This builder for chaining.
*/
public Builder setDetectedLanguageCode(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
detectedLanguageCode_ = value;
bitField0_ |= 0x00000004;
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;
*
* @return This builder for chaining.
*/
public Builder clearDetectedLanguageCode() {
detectedLanguageCode_ = getDefaultInstance().getDetectedLanguageCode();
bitField0_ = (bitField0_ & ~0x00000004);
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;
*
* @param value The bytes for detectedLanguageCode to set.
* @return This builder for chaining.
*/
public Builder setDetectedLanguageCodeBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
detectedLanguageCode_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}
private com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig glossaryConfig_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig,
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig.Builder,
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfigOrBuilder>
glossaryConfigBuilder_;
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*
* @return Whether the glossaryConfig field is set.
*/
public boolean hasGlossaryConfig() {
return ((bitField0_ & 0x00000008) != 0);
}
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*
* @return The glossaryConfig.
*/
public com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig getGlossaryConfig() {
if (glossaryConfigBuilder_ == null) {
return glossaryConfig_ == null
? com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig.getDefaultInstance()
: glossaryConfig_;
} else {
return glossaryConfigBuilder_.getMessage();
}
}
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*/
public Builder setGlossaryConfig(
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig value) {
if (glossaryConfigBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
glossaryConfig_ = value;
} else {
glossaryConfigBuilder_.setMessage(value);
}
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*/
public Builder setGlossaryConfig(
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig.Builder builderForValue) {
if (glossaryConfigBuilder_ == null) {
glossaryConfig_ = builderForValue.build();
} else {
glossaryConfigBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*/
public Builder mergeGlossaryConfig(
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig value) {
if (glossaryConfigBuilder_ == null) {
if (((bitField0_ & 0x00000008) != 0)
&& glossaryConfig_ != null
&& glossaryConfig_
!= com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig
.getDefaultInstance()) {
getGlossaryConfigBuilder().mergeFrom(value);
} else {
glossaryConfig_ = value;
}
} else {
glossaryConfigBuilder_.mergeFrom(value);
}
if (glossaryConfig_ != null) {
bitField0_ |= 0x00000008;
onChanged();
}
return this;
}
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*/
public Builder clearGlossaryConfig() {
bitField0_ = (bitField0_ & ~0x00000008);
glossaryConfig_ = null;
if (glossaryConfigBuilder_ != null) {
glossaryConfigBuilder_.dispose();
glossaryConfigBuilder_ = null;
}
onChanged();
return this;
}
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*/
public com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig.Builder
getGlossaryConfigBuilder() {
bitField0_ |= 0x00000008;
onChanged();
return getGlossaryConfigFieldBuilder().getBuilder();
}
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*/
public com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfigOrBuilder
getGlossaryConfigOrBuilder() {
if (glossaryConfigBuilder_ != null) {
return glossaryConfigBuilder_.getMessageOrBuilder();
} else {
return glossaryConfig_ == null
? com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig.getDefaultInstance()
: glossaryConfig_;
}
}
/**
*
*
*
* The `glossary_config` used for this translation.
*
*
* .google.cloud.translation.v3beta1.TranslateTextGlossaryConfig glossary_config = 3;
*
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig,
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig.Builder,
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfigOrBuilder>
getGlossaryConfigFieldBuilder() {
if (glossaryConfigBuilder_ == null) {
glossaryConfigBuilder_ =
new com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig,
com.google.cloud.translate.v3beta1.TranslateTextGlossaryConfig.Builder,
com.google.cloud.translate.v3beta1.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.v3beta1.Translation)
}
// @@protoc_insertion_point(class_scope:google.cloud.translation.v3beta1.Translation)
private static final com.google.cloud.translate.v3beta1.Translation DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.translate.v3beta1.Translation();
}
public static com.google.cloud.translate.v3beta1.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 {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
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.v3beta1.Translation getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}