1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Generated by the protocol buffer compiler. DO NOT EDIT! 17 // source: google/cloud/translate/v3/translation_service.proto 18 19 package com.google.cloud.translate.v3; 20 21 /** 22 * 23 * 24 * <pre> 25 * Input configuration for BatchTranslateText request. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.translation.v3.InputConfig} 29 */ 30 public final class InputConfig extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.translation.v3.InputConfig) 33 InputConfigOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use InputConfig.newBuilder() to construct. InputConfig(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private InputConfig(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 InputConfig()40 private InputConfig() { 41 mimeType_ = ""; 42 } 43 44 @java.lang.Override 45 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)46 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 47 return new InputConfig(); 48 } 49 50 @java.lang.Override getUnknownFields()51 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 52 return this.unknownFields; 53 } 54 getDescriptor()55 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 56 return com.google.cloud.translate.v3.TranslationServiceProto 57 .internal_static_google_cloud_translation_v3_InputConfig_descriptor; 58 } 59 60 @java.lang.Override 61 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()62 internalGetFieldAccessorTable() { 63 return com.google.cloud.translate.v3.TranslationServiceProto 64 .internal_static_google_cloud_translation_v3_InputConfig_fieldAccessorTable 65 .ensureFieldAccessorsInitialized( 66 com.google.cloud.translate.v3.InputConfig.class, 67 com.google.cloud.translate.v3.InputConfig.Builder.class); 68 } 69 70 private int sourceCase_ = 0; 71 private java.lang.Object source_; 72 73 public enum SourceCase 74 implements 75 com.google.protobuf.Internal.EnumLite, 76 com.google.protobuf.AbstractMessage.InternalOneOfEnum { 77 GCS_SOURCE(2), 78 SOURCE_NOT_SET(0); 79 private final int value; 80 SourceCase(int value)81 private SourceCase(int value) { 82 this.value = value; 83 } 84 /** 85 * @param value The number of the enum to look for. 86 * @return The enum associated with the given number. 87 * @deprecated Use {@link #forNumber(int)} instead. 88 */ 89 @java.lang.Deprecated valueOf(int value)90 public static SourceCase valueOf(int value) { 91 return forNumber(value); 92 } 93 forNumber(int value)94 public static SourceCase forNumber(int value) { 95 switch (value) { 96 case 2: 97 return GCS_SOURCE; 98 case 0: 99 return SOURCE_NOT_SET; 100 default: 101 return null; 102 } 103 } 104 getNumber()105 public int getNumber() { 106 return this.value; 107 } 108 }; 109 getSourceCase()110 public SourceCase getSourceCase() { 111 return SourceCase.forNumber(sourceCase_); 112 } 113 114 public static final int MIME_TYPE_FIELD_NUMBER = 1; 115 116 @SuppressWarnings("serial") 117 private volatile java.lang.Object mimeType_ = ""; 118 /** 119 * 120 * 121 * <pre> 122 * Optional. Can be "text/plain" or "text/html". 123 * For `.tsv`, "text/html" is used if mime_type is missing. 124 * For `.html`, this field must be "text/html" or empty. 125 * For `.txt`, this field must be "text/plain" or empty. 126 * </pre> 127 * 128 * <code>string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL];</code> 129 * 130 * @return The mimeType. 131 */ 132 @java.lang.Override getMimeType()133 public java.lang.String getMimeType() { 134 java.lang.Object ref = mimeType_; 135 if (ref instanceof java.lang.String) { 136 return (java.lang.String) ref; 137 } else { 138 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 139 java.lang.String s = bs.toStringUtf8(); 140 mimeType_ = s; 141 return s; 142 } 143 } 144 /** 145 * 146 * 147 * <pre> 148 * Optional. Can be "text/plain" or "text/html". 149 * For `.tsv`, "text/html" is used if mime_type is missing. 150 * For `.html`, this field must be "text/html" or empty. 151 * For `.txt`, this field must be "text/plain" or empty. 152 * </pre> 153 * 154 * <code>string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL];</code> 155 * 156 * @return The bytes for mimeType. 157 */ 158 @java.lang.Override getMimeTypeBytes()159 public com.google.protobuf.ByteString getMimeTypeBytes() { 160 java.lang.Object ref = mimeType_; 161 if (ref instanceof java.lang.String) { 162 com.google.protobuf.ByteString b = 163 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 164 mimeType_ = b; 165 return b; 166 } else { 167 return (com.google.protobuf.ByteString) ref; 168 } 169 } 170 171 public static final int GCS_SOURCE_FIELD_NUMBER = 2; 172 /** 173 * 174 * 175 * <pre> 176 * Required. Google Cloud Storage location for the source input. 177 * This can be a single file (for example, 178 * `gs://translation-test/input.tsv`) or a wildcard (for example, 179 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 180 * contain either one or two columns. The first column (optional) is the id 181 * of the text request. If the first column is missing, we use the row 182 * number (0-based) from the input file as the ID in the output file. The 183 * second column is the actual text to be 184 * translated. We recommend each row be <= 10K Unicode codepoints, 185 * otherwise an error might be returned. 186 * Note that the input tsv must be RFC 4180 compliant. 187 * You could use https://github.com/Clever/csvlint to check potential 188 * formatting errors in your tsv file. 189 * csvlint --delimiter='\t' your_input_file.tsv 190 * The other supported file extensions are `.txt` or `.html`, which is 191 * treated as a single large chunk of text. 192 * </pre> 193 * 194 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 195 * 196 * @return Whether the gcsSource field is set. 197 */ 198 @java.lang.Override hasGcsSource()199 public boolean hasGcsSource() { 200 return sourceCase_ == 2; 201 } 202 /** 203 * 204 * 205 * <pre> 206 * Required. Google Cloud Storage location for the source input. 207 * This can be a single file (for example, 208 * `gs://translation-test/input.tsv`) or a wildcard (for example, 209 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 210 * contain either one or two columns. The first column (optional) is the id 211 * of the text request. If the first column is missing, we use the row 212 * number (0-based) from the input file as the ID in the output file. The 213 * second column is the actual text to be 214 * translated. We recommend each row be <= 10K Unicode codepoints, 215 * otherwise an error might be returned. 216 * Note that the input tsv must be RFC 4180 compliant. 217 * You could use https://github.com/Clever/csvlint to check potential 218 * formatting errors in your tsv file. 219 * csvlint --delimiter='\t' your_input_file.tsv 220 * The other supported file extensions are `.txt` or `.html`, which is 221 * treated as a single large chunk of text. 222 * </pre> 223 * 224 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 225 * 226 * @return The gcsSource. 227 */ 228 @java.lang.Override getGcsSource()229 public com.google.cloud.translate.v3.GcsSource getGcsSource() { 230 if (sourceCase_ == 2) { 231 return (com.google.cloud.translate.v3.GcsSource) source_; 232 } 233 return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); 234 } 235 /** 236 * 237 * 238 * <pre> 239 * Required. Google Cloud Storage location for the source input. 240 * This can be a single file (for example, 241 * `gs://translation-test/input.tsv`) or a wildcard (for example, 242 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 243 * contain either one or two columns. The first column (optional) is the id 244 * of the text request. If the first column is missing, we use the row 245 * number (0-based) from the input file as the ID in the output file. The 246 * second column is the actual text to be 247 * translated. We recommend each row be <= 10K Unicode codepoints, 248 * otherwise an error might be returned. 249 * Note that the input tsv must be RFC 4180 compliant. 250 * You could use https://github.com/Clever/csvlint to check potential 251 * formatting errors in your tsv file. 252 * csvlint --delimiter='\t' your_input_file.tsv 253 * The other supported file extensions are `.txt` or `.html`, which is 254 * treated as a single large chunk of text. 255 * </pre> 256 * 257 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 258 */ 259 @java.lang.Override getGcsSourceOrBuilder()260 public com.google.cloud.translate.v3.GcsSourceOrBuilder getGcsSourceOrBuilder() { 261 if (sourceCase_ == 2) { 262 return (com.google.cloud.translate.v3.GcsSource) source_; 263 } 264 return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); 265 } 266 267 private byte memoizedIsInitialized = -1; 268 269 @java.lang.Override isInitialized()270 public final boolean isInitialized() { 271 byte isInitialized = memoizedIsInitialized; 272 if (isInitialized == 1) return true; 273 if (isInitialized == 0) return false; 274 275 memoizedIsInitialized = 1; 276 return true; 277 } 278 279 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)280 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 281 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(mimeType_)) { 282 com.google.protobuf.GeneratedMessageV3.writeString(output, 1, mimeType_); 283 } 284 if (sourceCase_ == 2) { 285 output.writeMessage(2, (com.google.cloud.translate.v3.GcsSource) source_); 286 } 287 getUnknownFields().writeTo(output); 288 } 289 290 @java.lang.Override getSerializedSize()291 public int getSerializedSize() { 292 int size = memoizedSize; 293 if (size != -1) return size; 294 295 size = 0; 296 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(mimeType_)) { 297 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, mimeType_); 298 } 299 if (sourceCase_ == 2) { 300 size += 301 com.google.protobuf.CodedOutputStream.computeMessageSize( 302 2, (com.google.cloud.translate.v3.GcsSource) source_); 303 } 304 size += getUnknownFields().getSerializedSize(); 305 memoizedSize = size; 306 return size; 307 } 308 309 @java.lang.Override equals(final java.lang.Object obj)310 public boolean equals(final java.lang.Object obj) { 311 if (obj == this) { 312 return true; 313 } 314 if (!(obj instanceof com.google.cloud.translate.v3.InputConfig)) { 315 return super.equals(obj); 316 } 317 com.google.cloud.translate.v3.InputConfig other = 318 (com.google.cloud.translate.v3.InputConfig) obj; 319 320 if (!getMimeType().equals(other.getMimeType())) return false; 321 if (!getSourceCase().equals(other.getSourceCase())) return false; 322 switch (sourceCase_) { 323 case 2: 324 if (!getGcsSource().equals(other.getGcsSource())) return false; 325 break; 326 case 0: 327 default: 328 } 329 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 330 return true; 331 } 332 333 @java.lang.Override hashCode()334 public int hashCode() { 335 if (memoizedHashCode != 0) { 336 return memoizedHashCode; 337 } 338 int hash = 41; 339 hash = (19 * hash) + getDescriptor().hashCode(); 340 hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER; 341 hash = (53 * hash) + getMimeType().hashCode(); 342 switch (sourceCase_) { 343 case 2: 344 hash = (37 * hash) + GCS_SOURCE_FIELD_NUMBER; 345 hash = (53 * hash) + getGcsSource().hashCode(); 346 break; 347 case 0: 348 default: 349 } 350 hash = (29 * hash) + getUnknownFields().hashCode(); 351 memoizedHashCode = hash; 352 return hash; 353 } 354 parseFrom(java.nio.ByteBuffer data)355 public static com.google.cloud.translate.v3.InputConfig parseFrom(java.nio.ByteBuffer data) 356 throws com.google.protobuf.InvalidProtocolBufferException { 357 return PARSER.parseFrom(data); 358 } 359 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)360 public static com.google.cloud.translate.v3.InputConfig parseFrom( 361 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 362 throws com.google.protobuf.InvalidProtocolBufferException { 363 return PARSER.parseFrom(data, extensionRegistry); 364 } 365 parseFrom( com.google.protobuf.ByteString data)366 public static com.google.cloud.translate.v3.InputConfig parseFrom( 367 com.google.protobuf.ByteString data) 368 throws com.google.protobuf.InvalidProtocolBufferException { 369 return PARSER.parseFrom(data); 370 } 371 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)372 public static com.google.cloud.translate.v3.InputConfig parseFrom( 373 com.google.protobuf.ByteString data, 374 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 375 throws com.google.protobuf.InvalidProtocolBufferException { 376 return PARSER.parseFrom(data, extensionRegistry); 377 } 378 parseFrom(byte[] data)379 public static com.google.cloud.translate.v3.InputConfig parseFrom(byte[] data) 380 throws com.google.protobuf.InvalidProtocolBufferException { 381 return PARSER.parseFrom(data); 382 } 383 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)384 public static com.google.cloud.translate.v3.InputConfig parseFrom( 385 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 386 throws com.google.protobuf.InvalidProtocolBufferException { 387 return PARSER.parseFrom(data, extensionRegistry); 388 } 389 parseFrom(java.io.InputStream input)390 public static com.google.cloud.translate.v3.InputConfig parseFrom(java.io.InputStream input) 391 throws java.io.IOException { 392 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 393 } 394 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)395 public static com.google.cloud.translate.v3.InputConfig parseFrom( 396 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 397 throws java.io.IOException { 398 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 399 PARSER, input, extensionRegistry); 400 } 401 parseDelimitedFrom( java.io.InputStream input)402 public static com.google.cloud.translate.v3.InputConfig parseDelimitedFrom( 403 java.io.InputStream input) throws java.io.IOException { 404 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 405 } 406 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)407 public static com.google.cloud.translate.v3.InputConfig parseDelimitedFrom( 408 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 409 throws java.io.IOException { 410 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 411 PARSER, input, extensionRegistry); 412 } 413 parseFrom( com.google.protobuf.CodedInputStream input)414 public static com.google.cloud.translate.v3.InputConfig parseFrom( 415 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 416 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 417 } 418 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)419 public static com.google.cloud.translate.v3.InputConfig parseFrom( 420 com.google.protobuf.CodedInputStream input, 421 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 422 throws java.io.IOException { 423 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 424 PARSER, input, extensionRegistry); 425 } 426 427 @java.lang.Override newBuilderForType()428 public Builder newBuilderForType() { 429 return newBuilder(); 430 } 431 newBuilder()432 public static Builder newBuilder() { 433 return DEFAULT_INSTANCE.toBuilder(); 434 } 435 newBuilder(com.google.cloud.translate.v3.InputConfig prototype)436 public static Builder newBuilder(com.google.cloud.translate.v3.InputConfig prototype) { 437 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 438 } 439 440 @java.lang.Override toBuilder()441 public Builder toBuilder() { 442 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 443 } 444 445 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)446 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 447 Builder builder = new Builder(parent); 448 return builder; 449 } 450 /** 451 * 452 * 453 * <pre> 454 * Input configuration for BatchTranslateText request. 455 * </pre> 456 * 457 * Protobuf type {@code google.cloud.translation.v3.InputConfig} 458 */ 459 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 460 implements 461 // @@protoc_insertion_point(builder_implements:google.cloud.translation.v3.InputConfig) 462 com.google.cloud.translate.v3.InputConfigOrBuilder { getDescriptor()463 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 464 return com.google.cloud.translate.v3.TranslationServiceProto 465 .internal_static_google_cloud_translation_v3_InputConfig_descriptor; 466 } 467 468 @java.lang.Override 469 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()470 internalGetFieldAccessorTable() { 471 return com.google.cloud.translate.v3.TranslationServiceProto 472 .internal_static_google_cloud_translation_v3_InputConfig_fieldAccessorTable 473 .ensureFieldAccessorsInitialized( 474 com.google.cloud.translate.v3.InputConfig.class, 475 com.google.cloud.translate.v3.InputConfig.Builder.class); 476 } 477 478 // Construct using com.google.cloud.translate.v3.InputConfig.newBuilder() Builder()479 private Builder() {} 480 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)481 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 482 super(parent); 483 } 484 485 @java.lang.Override clear()486 public Builder clear() { 487 super.clear(); 488 bitField0_ = 0; 489 mimeType_ = ""; 490 if (gcsSourceBuilder_ != null) { 491 gcsSourceBuilder_.clear(); 492 } 493 sourceCase_ = 0; 494 source_ = null; 495 return this; 496 } 497 498 @java.lang.Override getDescriptorForType()499 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 500 return com.google.cloud.translate.v3.TranslationServiceProto 501 .internal_static_google_cloud_translation_v3_InputConfig_descriptor; 502 } 503 504 @java.lang.Override getDefaultInstanceForType()505 public com.google.cloud.translate.v3.InputConfig getDefaultInstanceForType() { 506 return com.google.cloud.translate.v3.InputConfig.getDefaultInstance(); 507 } 508 509 @java.lang.Override build()510 public com.google.cloud.translate.v3.InputConfig build() { 511 com.google.cloud.translate.v3.InputConfig result = buildPartial(); 512 if (!result.isInitialized()) { 513 throw newUninitializedMessageException(result); 514 } 515 return result; 516 } 517 518 @java.lang.Override buildPartial()519 public com.google.cloud.translate.v3.InputConfig buildPartial() { 520 com.google.cloud.translate.v3.InputConfig result = 521 new com.google.cloud.translate.v3.InputConfig(this); 522 if (bitField0_ != 0) { 523 buildPartial0(result); 524 } 525 buildPartialOneofs(result); 526 onBuilt(); 527 return result; 528 } 529 buildPartial0(com.google.cloud.translate.v3.InputConfig result)530 private void buildPartial0(com.google.cloud.translate.v3.InputConfig result) { 531 int from_bitField0_ = bitField0_; 532 if (((from_bitField0_ & 0x00000001) != 0)) { 533 result.mimeType_ = mimeType_; 534 } 535 } 536 buildPartialOneofs(com.google.cloud.translate.v3.InputConfig result)537 private void buildPartialOneofs(com.google.cloud.translate.v3.InputConfig result) { 538 result.sourceCase_ = sourceCase_; 539 result.source_ = this.source_; 540 if (sourceCase_ == 2 && gcsSourceBuilder_ != null) { 541 result.source_ = gcsSourceBuilder_.build(); 542 } 543 } 544 545 @java.lang.Override clone()546 public Builder clone() { 547 return super.clone(); 548 } 549 550 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)551 public Builder setField( 552 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 553 return super.setField(field, value); 554 } 555 556 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)557 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 558 return super.clearField(field); 559 } 560 561 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)562 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 563 return super.clearOneof(oneof); 564 } 565 566 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)567 public Builder setRepeatedField( 568 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 569 return super.setRepeatedField(field, index, value); 570 } 571 572 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)573 public Builder addRepeatedField( 574 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 575 return super.addRepeatedField(field, value); 576 } 577 578 @java.lang.Override mergeFrom(com.google.protobuf.Message other)579 public Builder mergeFrom(com.google.protobuf.Message other) { 580 if (other instanceof com.google.cloud.translate.v3.InputConfig) { 581 return mergeFrom((com.google.cloud.translate.v3.InputConfig) other); 582 } else { 583 super.mergeFrom(other); 584 return this; 585 } 586 } 587 mergeFrom(com.google.cloud.translate.v3.InputConfig other)588 public Builder mergeFrom(com.google.cloud.translate.v3.InputConfig other) { 589 if (other == com.google.cloud.translate.v3.InputConfig.getDefaultInstance()) return this; 590 if (!other.getMimeType().isEmpty()) { 591 mimeType_ = other.mimeType_; 592 bitField0_ |= 0x00000001; 593 onChanged(); 594 } 595 switch (other.getSourceCase()) { 596 case GCS_SOURCE: 597 { 598 mergeGcsSource(other.getGcsSource()); 599 break; 600 } 601 case SOURCE_NOT_SET: 602 { 603 break; 604 } 605 } 606 this.mergeUnknownFields(other.getUnknownFields()); 607 onChanged(); 608 return this; 609 } 610 611 @java.lang.Override isInitialized()612 public final boolean isInitialized() { 613 return true; 614 } 615 616 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)617 public Builder mergeFrom( 618 com.google.protobuf.CodedInputStream input, 619 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 620 throws java.io.IOException { 621 if (extensionRegistry == null) { 622 throw new java.lang.NullPointerException(); 623 } 624 try { 625 boolean done = false; 626 while (!done) { 627 int tag = input.readTag(); 628 switch (tag) { 629 case 0: 630 done = true; 631 break; 632 case 10: 633 { 634 mimeType_ = input.readStringRequireUtf8(); 635 bitField0_ |= 0x00000001; 636 break; 637 } // case 10 638 case 18: 639 { 640 input.readMessage(getGcsSourceFieldBuilder().getBuilder(), extensionRegistry); 641 sourceCase_ = 2; 642 break; 643 } // case 18 644 default: 645 { 646 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 647 done = true; // was an endgroup tag 648 } 649 break; 650 } // default: 651 } // switch (tag) 652 } // while (!done) 653 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 654 throw e.unwrapIOException(); 655 } finally { 656 onChanged(); 657 } // finally 658 return this; 659 } 660 661 private int sourceCase_ = 0; 662 private java.lang.Object source_; 663 getSourceCase()664 public SourceCase getSourceCase() { 665 return SourceCase.forNumber(sourceCase_); 666 } 667 clearSource()668 public Builder clearSource() { 669 sourceCase_ = 0; 670 source_ = null; 671 onChanged(); 672 return this; 673 } 674 675 private int bitField0_; 676 677 private java.lang.Object mimeType_ = ""; 678 /** 679 * 680 * 681 * <pre> 682 * Optional. Can be "text/plain" or "text/html". 683 * For `.tsv`, "text/html" is used if mime_type is missing. 684 * For `.html`, this field must be "text/html" or empty. 685 * For `.txt`, this field must be "text/plain" or empty. 686 * </pre> 687 * 688 * <code>string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL];</code> 689 * 690 * @return The mimeType. 691 */ getMimeType()692 public java.lang.String getMimeType() { 693 java.lang.Object ref = mimeType_; 694 if (!(ref instanceof java.lang.String)) { 695 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 696 java.lang.String s = bs.toStringUtf8(); 697 mimeType_ = s; 698 return s; 699 } else { 700 return (java.lang.String) ref; 701 } 702 } 703 /** 704 * 705 * 706 * <pre> 707 * Optional. Can be "text/plain" or "text/html". 708 * For `.tsv`, "text/html" is used if mime_type is missing. 709 * For `.html`, this field must be "text/html" or empty. 710 * For `.txt`, this field must be "text/plain" or empty. 711 * </pre> 712 * 713 * <code>string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL];</code> 714 * 715 * @return The bytes for mimeType. 716 */ getMimeTypeBytes()717 public com.google.protobuf.ByteString getMimeTypeBytes() { 718 java.lang.Object ref = mimeType_; 719 if (ref instanceof String) { 720 com.google.protobuf.ByteString b = 721 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 722 mimeType_ = b; 723 return b; 724 } else { 725 return (com.google.protobuf.ByteString) ref; 726 } 727 } 728 /** 729 * 730 * 731 * <pre> 732 * Optional. Can be "text/plain" or "text/html". 733 * For `.tsv`, "text/html" is used if mime_type is missing. 734 * For `.html`, this field must be "text/html" or empty. 735 * For `.txt`, this field must be "text/plain" or empty. 736 * </pre> 737 * 738 * <code>string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL];</code> 739 * 740 * @param value The mimeType to set. 741 * @return This builder for chaining. 742 */ setMimeType(java.lang.String value)743 public Builder setMimeType(java.lang.String value) { 744 if (value == null) { 745 throw new NullPointerException(); 746 } 747 mimeType_ = value; 748 bitField0_ |= 0x00000001; 749 onChanged(); 750 return this; 751 } 752 /** 753 * 754 * 755 * <pre> 756 * Optional. Can be "text/plain" or "text/html". 757 * For `.tsv`, "text/html" is used if mime_type is missing. 758 * For `.html`, this field must be "text/html" or empty. 759 * For `.txt`, this field must be "text/plain" or empty. 760 * </pre> 761 * 762 * <code>string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL];</code> 763 * 764 * @return This builder for chaining. 765 */ clearMimeType()766 public Builder clearMimeType() { 767 mimeType_ = getDefaultInstance().getMimeType(); 768 bitField0_ = (bitField0_ & ~0x00000001); 769 onChanged(); 770 return this; 771 } 772 /** 773 * 774 * 775 * <pre> 776 * Optional. Can be "text/plain" or "text/html". 777 * For `.tsv`, "text/html" is used if mime_type is missing. 778 * For `.html`, this field must be "text/html" or empty. 779 * For `.txt`, this field must be "text/plain" or empty. 780 * </pre> 781 * 782 * <code>string mime_type = 1 [(.google.api.field_behavior) = OPTIONAL];</code> 783 * 784 * @param value The bytes for mimeType to set. 785 * @return This builder for chaining. 786 */ setMimeTypeBytes(com.google.protobuf.ByteString value)787 public Builder setMimeTypeBytes(com.google.protobuf.ByteString value) { 788 if (value == null) { 789 throw new NullPointerException(); 790 } 791 checkByteStringIsUtf8(value); 792 mimeType_ = value; 793 bitField0_ |= 0x00000001; 794 onChanged(); 795 return this; 796 } 797 798 private com.google.protobuf.SingleFieldBuilderV3< 799 com.google.cloud.translate.v3.GcsSource, 800 com.google.cloud.translate.v3.GcsSource.Builder, 801 com.google.cloud.translate.v3.GcsSourceOrBuilder> 802 gcsSourceBuilder_; 803 /** 804 * 805 * 806 * <pre> 807 * Required. Google Cloud Storage location for the source input. 808 * This can be a single file (for example, 809 * `gs://translation-test/input.tsv`) or a wildcard (for example, 810 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 811 * contain either one or two columns. The first column (optional) is the id 812 * of the text request. If the first column is missing, we use the row 813 * number (0-based) from the input file as the ID in the output file. The 814 * second column is the actual text to be 815 * translated. We recommend each row be <= 10K Unicode codepoints, 816 * otherwise an error might be returned. 817 * Note that the input tsv must be RFC 4180 compliant. 818 * You could use https://github.com/Clever/csvlint to check potential 819 * formatting errors in your tsv file. 820 * csvlint --delimiter='\t' your_input_file.tsv 821 * The other supported file extensions are `.txt` or `.html`, which is 822 * treated as a single large chunk of text. 823 * </pre> 824 * 825 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 826 * 827 * @return Whether the gcsSource field is set. 828 */ 829 @java.lang.Override hasGcsSource()830 public boolean hasGcsSource() { 831 return sourceCase_ == 2; 832 } 833 /** 834 * 835 * 836 * <pre> 837 * Required. Google Cloud Storage location for the source input. 838 * This can be a single file (for example, 839 * `gs://translation-test/input.tsv`) or a wildcard (for example, 840 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 841 * contain either one or two columns. The first column (optional) is the id 842 * of the text request. If the first column is missing, we use the row 843 * number (0-based) from the input file as the ID in the output file. The 844 * second column is the actual text to be 845 * translated. We recommend each row be <= 10K Unicode codepoints, 846 * otherwise an error might be returned. 847 * Note that the input tsv must be RFC 4180 compliant. 848 * You could use https://github.com/Clever/csvlint to check potential 849 * formatting errors in your tsv file. 850 * csvlint --delimiter='\t' your_input_file.tsv 851 * The other supported file extensions are `.txt` or `.html`, which is 852 * treated as a single large chunk of text. 853 * </pre> 854 * 855 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 856 * 857 * @return The gcsSource. 858 */ 859 @java.lang.Override getGcsSource()860 public com.google.cloud.translate.v3.GcsSource getGcsSource() { 861 if (gcsSourceBuilder_ == null) { 862 if (sourceCase_ == 2) { 863 return (com.google.cloud.translate.v3.GcsSource) source_; 864 } 865 return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); 866 } else { 867 if (sourceCase_ == 2) { 868 return gcsSourceBuilder_.getMessage(); 869 } 870 return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); 871 } 872 } 873 /** 874 * 875 * 876 * <pre> 877 * Required. Google Cloud Storage location for the source input. 878 * This can be a single file (for example, 879 * `gs://translation-test/input.tsv`) or a wildcard (for example, 880 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 881 * contain either one or two columns. The first column (optional) is the id 882 * of the text request. If the first column is missing, we use the row 883 * number (0-based) from the input file as the ID in the output file. The 884 * second column is the actual text to be 885 * translated. We recommend each row be <= 10K Unicode codepoints, 886 * otherwise an error might be returned. 887 * Note that the input tsv must be RFC 4180 compliant. 888 * You could use https://github.com/Clever/csvlint to check potential 889 * formatting errors in your tsv file. 890 * csvlint --delimiter='\t' your_input_file.tsv 891 * The other supported file extensions are `.txt` or `.html`, which is 892 * treated as a single large chunk of text. 893 * </pre> 894 * 895 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 896 */ setGcsSource(com.google.cloud.translate.v3.GcsSource value)897 public Builder setGcsSource(com.google.cloud.translate.v3.GcsSource value) { 898 if (gcsSourceBuilder_ == null) { 899 if (value == null) { 900 throw new NullPointerException(); 901 } 902 source_ = value; 903 onChanged(); 904 } else { 905 gcsSourceBuilder_.setMessage(value); 906 } 907 sourceCase_ = 2; 908 return this; 909 } 910 /** 911 * 912 * 913 * <pre> 914 * Required. Google Cloud Storage location for the source input. 915 * This can be a single file (for example, 916 * `gs://translation-test/input.tsv`) or a wildcard (for example, 917 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 918 * contain either one or two columns. The first column (optional) is the id 919 * of the text request. If the first column is missing, we use the row 920 * number (0-based) from the input file as the ID in the output file. The 921 * second column is the actual text to be 922 * translated. We recommend each row be <= 10K Unicode codepoints, 923 * otherwise an error might be returned. 924 * Note that the input tsv must be RFC 4180 compliant. 925 * You could use https://github.com/Clever/csvlint to check potential 926 * formatting errors in your tsv file. 927 * csvlint --delimiter='\t' your_input_file.tsv 928 * The other supported file extensions are `.txt` or `.html`, which is 929 * treated as a single large chunk of text. 930 * </pre> 931 * 932 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 933 */ setGcsSource(com.google.cloud.translate.v3.GcsSource.Builder builderForValue)934 public Builder setGcsSource(com.google.cloud.translate.v3.GcsSource.Builder builderForValue) { 935 if (gcsSourceBuilder_ == null) { 936 source_ = builderForValue.build(); 937 onChanged(); 938 } else { 939 gcsSourceBuilder_.setMessage(builderForValue.build()); 940 } 941 sourceCase_ = 2; 942 return this; 943 } 944 /** 945 * 946 * 947 * <pre> 948 * Required. Google Cloud Storage location for the source input. 949 * This can be a single file (for example, 950 * `gs://translation-test/input.tsv`) or a wildcard (for example, 951 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 952 * contain either one or two columns. The first column (optional) is the id 953 * of the text request. If the first column is missing, we use the row 954 * number (0-based) from the input file as the ID in the output file. The 955 * second column is the actual text to be 956 * translated. We recommend each row be <= 10K Unicode codepoints, 957 * otherwise an error might be returned. 958 * Note that the input tsv must be RFC 4180 compliant. 959 * You could use https://github.com/Clever/csvlint to check potential 960 * formatting errors in your tsv file. 961 * csvlint --delimiter='\t' your_input_file.tsv 962 * The other supported file extensions are `.txt` or `.html`, which is 963 * treated as a single large chunk of text. 964 * </pre> 965 * 966 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 967 */ mergeGcsSource(com.google.cloud.translate.v3.GcsSource value)968 public Builder mergeGcsSource(com.google.cloud.translate.v3.GcsSource value) { 969 if (gcsSourceBuilder_ == null) { 970 if (sourceCase_ == 2 971 && source_ != com.google.cloud.translate.v3.GcsSource.getDefaultInstance()) { 972 source_ = 973 com.google.cloud.translate.v3.GcsSource.newBuilder( 974 (com.google.cloud.translate.v3.GcsSource) source_) 975 .mergeFrom(value) 976 .buildPartial(); 977 } else { 978 source_ = value; 979 } 980 onChanged(); 981 } else { 982 if (sourceCase_ == 2) { 983 gcsSourceBuilder_.mergeFrom(value); 984 } else { 985 gcsSourceBuilder_.setMessage(value); 986 } 987 } 988 sourceCase_ = 2; 989 return this; 990 } 991 /** 992 * 993 * 994 * <pre> 995 * Required. Google Cloud Storage location for the source input. 996 * This can be a single file (for example, 997 * `gs://translation-test/input.tsv`) or a wildcard (for example, 998 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 999 * contain either one or two columns. The first column (optional) is the id 1000 * of the text request. If the first column is missing, we use the row 1001 * number (0-based) from the input file as the ID in the output file. The 1002 * second column is the actual text to be 1003 * translated. We recommend each row be <= 10K Unicode codepoints, 1004 * otherwise an error might be returned. 1005 * Note that the input tsv must be RFC 4180 compliant. 1006 * You could use https://github.com/Clever/csvlint to check potential 1007 * formatting errors in your tsv file. 1008 * csvlint --delimiter='\t' your_input_file.tsv 1009 * The other supported file extensions are `.txt` or `.html`, which is 1010 * treated as a single large chunk of text. 1011 * </pre> 1012 * 1013 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 1014 */ clearGcsSource()1015 public Builder clearGcsSource() { 1016 if (gcsSourceBuilder_ == null) { 1017 if (sourceCase_ == 2) { 1018 sourceCase_ = 0; 1019 source_ = null; 1020 onChanged(); 1021 } 1022 } else { 1023 if (sourceCase_ == 2) { 1024 sourceCase_ = 0; 1025 source_ = null; 1026 } 1027 gcsSourceBuilder_.clear(); 1028 } 1029 return this; 1030 } 1031 /** 1032 * 1033 * 1034 * <pre> 1035 * Required. Google Cloud Storage location for the source input. 1036 * This can be a single file (for example, 1037 * `gs://translation-test/input.tsv`) or a wildcard (for example, 1038 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 1039 * contain either one or two columns. The first column (optional) is the id 1040 * of the text request. If the first column is missing, we use the row 1041 * number (0-based) from the input file as the ID in the output file. The 1042 * second column is the actual text to be 1043 * translated. We recommend each row be <= 10K Unicode codepoints, 1044 * otherwise an error might be returned. 1045 * Note that the input tsv must be RFC 4180 compliant. 1046 * You could use https://github.com/Clever/csvlint to check potential 1047 * formatting errors in your tsv file. 1048 * csvlint --delimiter='\t' your_input_file.tsv 1049 * The other supported file extensions are `.txt` or `.html`, which is 1050 * treated as a single large chunk of text. 1051 * </pre> 1052 * 1053 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 1054 */ getGcsSourceBuilder()1055 public com.google.cloud.translate.v3.GcsSource.Builder getGcsSourceBuilder() { 1056 return getGcsSourceFieldBuilder().getBuilder(); 1057 } 1058 /** 1059 * 1060 * 1061 * <pre> 1062 * Required. Google Cloud Storage location for the source input. 1063 * This can be a single file (for example, 1064 * `gs://translation-test/input.tsv`) or a wildcard (for example, 1065 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 1066 * contain either one or two columns. The first column (optional) is the id 1067 * of the text request. If the first column is missing, we use the row 1068 * number (0-based) from the input file as the ID in the output file. The 1069 * second column is the actual text to be 1070 * translated. We recommend each row be <= 10K Unicode codepoints, 1071 * otherwise an error might be returned. 1072 * Note that the input tsv must be RFC 4180 compliant. 1073 * You could use https://github.com/Clever/csvlint to check potential 1074 * formatting errors in your tsv file. 1075 * csvlint --delimiter='\t' your_input_file.tsv 1076 * The other supported file extensions are `.txt` or `.html`, which is 1077 * treated as a single large chunk of text. 1078 * </pre> 1079 * 1080 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 1081 */ 1082 @java.lang.Override getGcsSourceOrBuilder()1083 public com.google.cloud.translate.v3.GcsSourceOrBuilder getGcsSourceOrBuilder() { 1084 if ((sourceCase_ == 2) && (gcsSourceBuilder_ != null)) { 1085 return gcsSourceBuilder_.getMessageOrBuilder(); 1086 } else { 1087 if (sourceCase_ == 2) { 1088 return (com.google.cloud.translate.v3.GcsSource) source_; 1089 } 1090 return com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); 1091 } 1092 } 1093 /** 1094 * 1095 * 1096 * <pre> 1097 * Required. Google Cloud Storage location for the source input. 1098 * This can be a single file (for example, 1099 * `gs://translation-test/input.tsv`) or a wildcard (for example, 1100 * `gs://translation-test/*`). If a file extension is `.tsv`, it can 1101 * contain either one or two columns. The first column (optional) is the id 1102 * of the text request. If the first column is missing, we use the row 1103 * number (0-based) from the input file as the ID in the output file. The 1104 * second column is the actual text to be 1105 * translated. We recommend each row be <= 10K Unicode codepoints, 1106 * otherwise an error might be returned. 1107 * Note that the input tsv must be RFC 4180 compliant. 1108 * You could use https://github.com/Clever/csvlint to check potential 1109 * formatting errors in your tsv file. 1110 * csvlint --delimiter='\t' your_input_file.tsv 1111 * The other supported file extensions are `.txt` or `.html`, which is 1112 * treated as a single large chunk of text. 1113 * </pre> 1114 * 1115 * <code>.google.cloud.translation.v3.GcsSource gcs_source = 2;</code> 1116 */ 1117 private com.google.protobuf.SingleFieldBuilderV3< 1118 com.google.cloud.translate.v3.GcsSource, 1119 com.google.cloud.translate.v3.GcsSource.Builder, 1120 com.google.cloud.translate.v3.GcsSourceOrBuilder> getGcsSourceFieldBuilder()1121 getGcsSourceFieldBuilder() { 1122 if (gcsSourceBuilder_ == null) { 1123 if (!(sourceCase_ == 2)) { 1124 source_ = com.google.cloud.translate.v3.GcsSource.getDefaultInstance(); 1125 } 1126 gcsSourceBuilder_ = 1127 new com.google.protobuf.SingleFieldBuilderV3< 1128 com.google.cloud.translate.v3.GcsSource, 1129 com.google.cloud.translate.v3.GcsSource.Builder, 1130 com.google.cloud.translate.v3.GcsSourceOrBuilder>( 1131 (com.google.cloud.translate.v3.GcsSource) source_, 1132 getParentForChildren(), 1133 isClean()); 1134 source_ = null; 1135 } 1136 sourceCase_ = 2; 1137 onChanged(); 1138 return gcsSourceBuilder_; 1139 } 1140 1141 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1142 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 1143 return super.setUnknownFields(unknownFields); 1144 } 1145 1146 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1147 public final Builder mergeUnknownFields( 1148 final com.google.protobuf.UnknownFieldSet unknownFields) { 1149 return super.mergeUnknownFields(unknownFields); 1150 } 1151 1152 // @@protoc_insertion_point(builder_scope:google.cloud.translation.v3.InputConfig) 1153 } 1154 1155 // @@protoc_insertion_point(class_scope:google.cloud.translation.v3.InputConfig) 1156 private static final com.google.cloud.translate.v3.InputConfig DEFAULT_INSTANCE; 1157 1158 static { 1159 DEFAULT_INSTANCE = new com.google.cloud.translate.v3.InputConfig(); 1160 } 1161 getDefaultInstance()1162 public static com.google.cloud.translate.v3.InputConfig getDefaultInstance() { 1163 return DEFAULT_INSTANCE; 1164 } 1165 1166 private static final com.google.protobuf.Parser<InputConfig> PARSER = 1167 new com.google.protobuf.AbstractParser<InputConfig>() { 1168 @java.lang.Override 1169 public InputConfig parsePartialFrom( 1170 com.google.protobuf.CodedInputStream input, 1171 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1172 throws com.google.protobuf.InvalidProtocolBufferException { 1173 Builder builder = newBuilder(); 1174 try { 1175 builder.mergeFrom(input, extensionRegistry); 1176 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1177 throw e.setUnfinishedMessage(builder.buildPartial()); 1178 } catch (com.google.protobuf.UninitializedMessageException e) { 1179 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 1180 } catch (java.io.IOException e) { 1181 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1182 .setUnfinishedMessage(builder.buildPartial()); 1183 } 1184 return builder.buildPartial(); 1185 } 1186 }; 1187 parser()1188 public static com.google.protobuf.Parser<InputConfig> parser() { 1189 return PARSER; 1190 } 1191 1192 @java.lang.Override getParserForType()1193 public com.google.protobuf.Parser<InputConfig> getParserForType() { 1194 return PARSER; 1195 } 1196 1197 @java.lang.Override getDefaultInstanceForType()1198 public com.google.cloud.translate.v3.InputConfig getDefaultInstanceForType() { 1199 return DEFAULT_INSTANCE; 1200 } 1201 } 1202