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/automl/v1/data_items.proto 18 19 package com.google.cloud.automl.v1; 20 21 /** 22 * 23 * 24 * <pre> 25 * A representation of a text snippet. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.automl.v1.TextSnippet} 29 */ 30 public final class TextSnippet extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.automl.v1.TextSnippet) 33 TextSnippetOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use TextSnippet.newBuilder() to construct. TextSnippet(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private TextSnippet(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 TextSnippet()40 private TextSnippet() { 41 content_ = ""; 42 mimeType_ = ""; 43 contentUri_ = ""; 44 } 45 46 @java.lang.Override 47 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)48 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 49 return new TextSnippet(); 50 } 51 52 @java.lang.Override getUnknownFields()53 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 54 return this.unknownFields; 55 } 56 getDescriptor()57 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 58 return com.google.cloud.automl.v1.DataItems 59 .internal_static_google_cloud_automl_v1_TextSnippet_descriptor; 60 } 61 62 @java.lang.Override 63 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()64 internalGetFieldAccessorTable() { 65 return com.google.cloud.automl.v1.DataItems 66 .internal_static_google_cloud_automl_v1_TextSnippet_fieldAccessorTable 67 .ensureFieldAccessorsInitialized( 68 com.google.cloud.automl.v1.TextSnippet.class, 69 com.google.cloud.automl.v1.TextSnippet.Builder.class); 70 } 71 72 public static final int CONTENT_FIELD_NUMBER = 1; 73 74 @SuppressWarnings("serial") 75 private volatile java.lang.Object content_ = ""; 76 /** 77 * 78 * 79 * <pre> 80 * Required. The content of the text snippet as a string. Up to 250000 81 * characters long. 82 * </pre> 83 * 84 * <code>string content = 1;</code> 85 * 86 * @return The content. 87 */ 88 @java.lang.Override getContent()89 public java.lang.String getContent() { 90 java.lang.Object ref = content_; 91 if (ref instanceof java.lang.String) { 92 return (java.lang.String) ref; 93 } else { 94 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 95 java.lang.String s = bs.toStringUtf8(); 96 content_ = s; 97 return s; 98 } 99 } 100 /** 101 * 102 * 103 * <pre> 104 * Required. The content of the text snippet as a string. Up to 250000 105 * characters long. 106 * </pre> 107 * 108 * <code>string content = 1;</code> 109 * 110 * @return The bytes for content. 111 */ 112 @java.lang.Override getContentBytes()113 public com.google.protobuf.ByteString getContentBytes() { 114 java.lang.Object ref = content_; 115 if (ref instanceof java.lang.String) { 116 com.google.protobuf.ByteString b = 117 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 118 content_ = b; 119 return b; 120 } else { 121 return (com.google.protobuf.ByteString) ref; 122 } 123 } 124 125 public static final int MIME_TYPE_FIELD_NUMBER = 2; 126 127 @SuppressWarnings("serial") 128 private volatile java.lang.Object mimeType_ = ""; 129 /** 130 * 131 * 132 * <pre> 133 * Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed 134 * values are "text/html" and "text/plain". If left blank, the format is 135 * automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content]. 136 * </pre> 137 * 138 * <code>string mime_type = 2;</code> 139 * 140 * @return The mimeType. 141 */ 142 @java.lang.Override getMimeType()143 public java.lang.String getMimeType() { 144 java.lang.Object ref = mimeType_; 145 if (ref instanceof java.lang.String) { 146 return (java.lang.String) ref; 147 } else { 148 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 149 java.lang.String s = bs.toStringUtf8(); 150 mimeType_ = s; 151 return s; 152 } 153 } 154 /** 155 * 156 * 157 * <pre> 158 * Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed 159 * values are "text/html" and "text/plain". If left blank, the format is 160 * automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content]. 161 * </pre> 162 * 163 * <code>string mime_type = 2;</code> 164 * 165 * @return The bytes for mimeType. 166 */ 167 @java.lang.Override getMimeTypeBytes()168 public com.google.protobuf.ByteString getMimeTypeBytes() { 169 java.lang.Object ref = mimeType_; 170 if (ref instanceof java.lang.String) { 171 com.google.protobuf.ByteString b = 172 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 173 mimeType_ = b; 174 return b; 175 } else { 176 return (com.google.protobuf.ByteString) ref; 177 } 178 } 179 180 public static final int CONTENT_URI_FIELD_NUMBER = 4; 181 182 @SuppressWarnings("serial") 183 private volatile java.lang.Object contentUri_ = ""; 184 /** 185 * 186 * 187 * <pre> 188 * Output only. HTTP URI where you can download the content. 189 * </pre> 190 * 191 * <code>string content_uri = 4;</code> 192 * 193 * @return The contentUri. 194 */ 195 @java.lang.Override getContentUri()196 public java.lang.String getContentUri() { 197 java.lang.Object ref = contentUri_; 198 if (ref instanceof java.lang.String) { 199 return (java.lang.String) ref; 200 } else { 201 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 202 java.lang.String s = bs.toStringUtf8(); 203 contentUri_ = s; 204 return s; 205 } 206 } 207 /** 208 * 209 * 210 * <pre> 211 * Output only. HTTP URI where you can download the content. 212 * </pre> 213 * 214 * <code>string content_uri = 4;</code> 215 * 216 * @return The bytes for contentUri. 217 */ 218 @java.lang.Override getContentUriBytes()219 public com.google.protobuf.ByteString getContentUriBytes() { 220 java.lang.Object ref = contentUri_; 221 if (ref instanceof java.lang.String) { 222 com.google.protobuf.ByteString b = 223 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 224 contentUri_ = b; 225 return b; 226 } else { 227 return (com.google.protobuf.ByteString) ref; 228 } 229 } 230 231 private byte memoizedIsInitialized = -1; 232 233 @java.lang.Override isInitialized()234 public final boolean isInitialized() { 235 byte isInitialized = memoizedIsInitialized; 236 if (isInitialized == 1) return true; 237 if (isInitialized == 0) return false; 238 239 memoizedIsInitialized = 1; 240 return true; 241 } 242 243 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)244 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 245 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(content_)) { 246 com.google.protobuf.GeneratedMessageV3.writeString(output, 1, content_); 247 } 248 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(mimeType_)) { 249 com.google.protobuf.GeneratedMessageV3.writeString(output, 2, mimeType_); 250 } 251 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(contentUri_)) { 252 com.google.protobuf.GeneratedMessageV3.writeString(output, 4, contentUri_); 253 } 254 getUnknownFields().writeTo(output); 255 } 256 257 @java.lang.Override getSerializedSize()258 public int getSerializedSize() { 259 int size = memoizedSize; 260 if (size != -1) return size; 261 262 size = 0; 263 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(content_)) { 264 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, content_); 265 } 266 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(mimeType_)) { 267 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, mimeType_); 268 } 269 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(contentUri_)) { 270 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, contentUri_); 271 } 272 size += getUnknownFields().getSerializedSize(); 273 memoizedSize = size; 274 return size; 275 } 276 277 @java.lang.Override equals(final java.lang.Object obj)278 public boolean equals(final java.lang.Object obj) { 279 if (obj == this) { 280 return true; 281 } 282 if (!(obj instanceof com.google.cloud.automl.v1.TextSnippet)) { 283 return super.equals(obj); 284 } 285 com.google.cloud.automl.v1.TextSnippet other = (com.google.cloud.automl.v1.TextSnippet) obj; 286 287 if (!getContent().equals(other.getContent())) return false; 288 if (!getMimeType().equals(other.getMimeType())) return false; 289 if (!getContentUri().equals(other.getContentUri())) return false; 290 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 291 return true; 292 } 293 294 @java.lang.Override hashCode()295 public int hashCode() { 296 if (memoizedHashCode != 0) { 297 return memoizedHashCode; 298 } 299 int hash = 41; 300 hash = (19 * hash) + getDescriptor().hashCode(); 301 hash = (37 * hash) + CONTENT_FIELD_NUMBER; 302 hash = (53 * hash) + getContent().hashCode(); 303 hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER; 304 hash = (53 * hash) + getMimeType().hashCode(); 305 hash = (37 * hash) + CONTENT_URI_FIELD_NUMBER; 306 hash = (53 * hash) + getContentUri().hashCode(); 307 hash = (29 * hash) + getUnknownFields().hashCode(); 308 memoizedHashCode = hash; 309 return hash; 310 } 311 parseFrom(java.nio.ByteBuffer data)312 public static com.google.cloud.automl.v1.TextSnippet parseFrom(java.nio.ByteBuffer data) 313 throws com.google.protobuf.InvalidProtocolBufferException { 314 return PARSER.parseFrom(data); 315 } 316 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)317 public static com.google.cloud.automl.v1.TextSnippet parseFrom( 318 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 319 throws com.google.protobuf.InvalidProtocolBufferException { 320 return PARSER.parseFrom(data, extensionRegistry); 321 } 322 parseFrom( com.google.protobuf.ByteString data)323 public static com.google.cloud.automl.v1.TextSnippet parseFrom( 324 com.google.protobuf.ByteString data) 325 throws com.google.protobuf.InvalidProtocolBufferException { 326 return PARSER.parseFrom(data); 327 } 328 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)329 public static com.google.cloud.automl.v1.TextSnippet parseFrom( 330 com.google.protobuf.ByteString data, 331 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 332 throws com.google.protobuf.InvalidProtocolBufferException { 333 return PARSER.parseFrom(data, extensionRegistry); 334 } 335 parseFrom(byte[] data)336 public static com.google.cloud.automl.v1.TextSnippet parseFrom(byte[] data) 337 throws com.google.protobuf.InvalidProtocolBufferException { 338 return PARSER.parseFrom(data); 339 } 340 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)341 public static com.google.cloud.automl.v1.TextSnippet parseFrom( 342 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 343 throws com.google.protobuf.InvalidProtocolBufferException { 344 return PARSER.parseFrom(data, extensionRegistry); 345 } 346 parseFrom(java.io.InputStream input)347 public static com.google.cloud.automl.v1.TextSnippet parseFrom(java.io.InputStream input) 348 throws java.io.IOException { 349 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 350 } 351 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)352 public static com.google.cloud.automl.v1.TextSnippet parseFrom( 353 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 354 throws java.io.IOException { 355 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 356 PARSER, input, extensionRegistry); 357 } 358 parseDelimitedFrom(java.io.InputStream input)359 public static com.google.cloud.automl.v1.TextSnippet parseDelimitedFrom(java.io.InputStream input) 360 throws java.io.IOException { 361 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 362 } 363 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)364 public static com.google.cloud.automl.v1.TextSnippet parseDelimitedFrom( 365 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 366 throws java.io.IOException { 367 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 368 PARSER, input, extensionRegistry); 369 } 370 parseFrom( com.google.protobuf.CodedInputStream input)371 public static com.google.cloud.automl.v1.TextSnippet parseFrom( 372 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 373 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 374 } 375 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)376 public static com.google.cloud.automl.v1.TextSnippet parseFrom( 377 com.google.protobuf.CodedInputStream input, 378 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 379 throws java.io.IOException { 380 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 381 PARSER, input, extensionRegistry); 382 } 383 384 @java.lang.Override newBuilderForType()385 public Builder newBuilderForType() { 386 return newBuilder(); 387 } 388 newBuilder()389 public static Builder newBuilder() { 390 return DEFAULT_INSTANCE.toBuilder(); 391 } 392 newBuilder(com.google.cloud.automl.v1.TextSnippet prototype)393 public static Builder newBuilder(com.google.cloud.automl.v1.TextSnippet prototype) { 394 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 395 } 396 397 @java.lang.Override toBuilder()398 public Builder toBuilder() { 399 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 400 } 401 402 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)403 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 404 Builder builder = new Builder(parent); 405 return builder; 406 } 407 /** 408 * 409 * 410 * <pre> 411 * A representation of a text snippet. 412 * </pre> 413 * 414 * Protobuf type {@code google.cloud.automl.v1.TextSnippet} 415 */ 416 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 417 implements 418 // @@protoc_insertion_point(builder_implements:google.cloud.automl.v1.TextSnippet) 419 com.google.cloud.automl.v1.TextSnippetOrBuilder { getDescriptor()420 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 421 return com.google.cloud.automl.v1.DataItems 422 .internal_static_google_cloud_automl_v1_TextSnippet_descriptor; 423 } 424 425 @java.lang.Override 426 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()427 internalGetFieldAccessorTable() { 428 return com.google.cloud.automl.v1.DataItems 429 .internal_static_google_cloud_automl_v1_TextSnippet_fieldAccessorTable 430 .ensureFieldAccessorsInitialized( 431 com.google.cloud.automl.v1.TextSnippet.class, 432 com.google.cloud.automl.v1.TextSnippet.Builder.class); 433 } 434 435 // Construct using com.google.cloud.automl.v1.TextSnippet.newBuilder() Builder()436 private Builder() {} 437 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)438 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 439 super(parent); 440 } 441 442 @java.lang.Override clear()443 public Builder clear() { 444 super.clear(); 445 bitField0_ = 0; 446 content_ = ""; 447 mimeType_ = ""; 448 contentUri_ = ""; 449 return this; 450 } 451 452 @java.lang.Override getDescriptorForType()453 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 454 return com.google.cloud.automl.v1.DataItems 455 .internal_static_google_cloud_automl_v1_TextSnippet_descriptor; 456 } 457 458 @java.lang.Override getDefaultInstanceForType()459 public com.google.cloud.automl.v1.TextSnippet getDefaultInstanceForType() { 460 return com.google.cloud.automl.v1.TextSnippet.getDefaultInstance(); 461 } 462 463 @java.lang.Override build()464 public com.google.cloud.automl.v1.TextSnippet build() { 465 com.google.cloud.automl.v1.TextSnippet result = buildPartial(); 466 if (!result.isInitialized()) { 467 throw newUninitializedMessageException(result); 468 } 469 return result; 470 } 471 472 @java.lang.Override buildPartial()473 public com.google.cloud.automl.v1.TextSnippet buildPartial() { 474 com.google.cloud.automl.v1.TextSnippet result = 475 new com.google.cloud.automl.v1.TextSnippet(this); 476 if (bitField0_ != 0) { 477 buildPartial0(result); 478 } 479 onBuilt(); 480 return result; 481 } 482 buildPartial0(com.google.cloud.automl.v1.TextSnippet result)483 private void buildPartial0(com.google.cloud.automl.v1.TextSnippet result) { 484 int from_bitField0_ = bitField0_; 485 if (((from_bitField0_ & 0x00000001) != 0)) { 486 result.content_ = content_; 487 } 488 if (((from_bitField0_ & 0x00000002) != 0)) { 489 result.mimeType_ = mimeType_; 490 } 491 if (((from_bitField0_ & 0x00000004) != 0)) { 492 result.contentUri_ = contentUri_; 493 } 494 } 495 496 @java.lang.Override clone()497 public Builder clone() { 498 return super.clone(); 499 } 500 501 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)502 public Builder setField( 503 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 504 return super.setField(field, value); 505 } 506 507 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)508 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 509 return super.clearField(field); 510 } 511 512 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)513 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 514 return super.clearOneof(oneof); 515 } 516 517 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)518 public Builder setRepeatedField( 519 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 520 return super.setRepeatedField(field, index, value); 521 } 522 523 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)524 public Builder addRepeatedField( 525 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 526 return super.addRepeatedField(field, value); 527 } 528 529 @java.lang.Override mergeFrom(com.google.protobuf.Message other)530 public Builder mergeFrom(com.google.protobuf.Message other) { 531 if (other instanceof com.google.cloud.automl.v1.TextSnippet) { 532 return mergeFrom((com.google.cloud.automl.v1.TextSnippet) other); 533 } else { 534 super.mergeFrom(other); 535 return this; 536 } 537 } 538 mergeFrom(com.google.cloud.automl.v1.TextSnippet other)539 public Builder mergeFrom(com.google.cloud.automl.v1.TextSnippet other) { 540 if (other == com.google.cloud.automl.v1.TextSnippet.getDefaultInstance()) return this; 541 if (!other.getContent().isEmpty()) { 542 content_ = other.content_; 543 bitField0_ |= 0x00000001; 544 onChanged(); 545 } 546 if (!other.getMimeType().isEmpty()) { 547 mimeType_ = other.mimeType_; 548 bitField0_ |= 0x00000002; 549 onChanged(); 550 } 551 if (!other.getContentUri().isEmpty()) { 552 contentUri_ = other.contentUri_; 553 bitField0_ |= 0x00000004; 554 onChanged(); 555 } 556 this.mergeUnknownFields(other.getUnknownFields()); 557 onChanged(); 558 return this; 559 } 560 561 @java.lang.Override isInitialized()562 public final boolean isInitialized() { 563 return true; 564 } 565 566 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)567 public Builder mergeFrom( 568 com.google.protobuf.CodedInputStream input, 569 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 570 throws java.io.IOException { 571 if (extensionRegistry == null) { 572 throw new java.lang.NullPointerException(); 573 } 574 try { 575 boolean done = false; 576 while (!done) { 577 int tag = input.readTag(); 578 switch (tag) { 579 case 0: 580 done = true; 581 break; 582 case 10: 583 { 584 content_ = input.readStringRequireUtf8(); 585 bitField0_ |= 0x00000001; 586 break; 587 } // case 10 588 case 18: 589 { 590 mimeType_ = input.readStringRequireUtf8(); 591 bitField0_ |= 0x00000002; 592 break; 593 } // case 18 594 case 34: 595 { 596 contentUri_ = input.readStringRequireUtf8(); 597 bitField0_ |= 0x00000004; 598 break; 599 } // case 34 600 default: 601 { 602 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 603 done = true; // was an endgroup tag 604 } 605 break; 606 } // default: 607 } // switch (tag) 608 } // while (!done) 609 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 610 throw e.unwrapIOException(); 611 } finally { 612 onChanged(); 613 } // finally 614 return this; 615 } 616 617 private int bitField0_; 618 619 private java.lang.Object content_ = ""; 620 /** 621 * 622 * 623 * <pre> 624 * Required. The content of the text snippet as a string. Up to 250000 625 * characters long. 626 * </pre> 627 * 628 * <code>string content = 1;</code> 629 * 630 * @return The content. 631 */ getContent()632 public java.lang.String getContent() { 633 java.lang.Object ref = content_; 634 if (!(ref instanceof java.lang.String)) { 635 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 636 java.lang.String s = bs.toStringUtf8(); 637 content_ = s; 638 return s; 639 } else { 640 return (java.lang.String) ref; 641 } 642 } 643 /** 644 * 645 * 646 * <pre> 647 * Required. The content of the text snippet as a string. Up to 250000 648 * characters long. 649 * </pre> 650 * 651 * <code>string content = 1;</code> 652 * 653 * @return The bytes for content. 654 */ getContentBytes()655 public com.google.protobuf.ByteString getContentBytes() { 656 java.lang.Object ref = content_; 657 if (ref instanceof String) { 658 com.google.protobuf.ByteString b = 659 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 660 content_ = b; 661 return b; 662 } else { 663 return (com.google.protobuf.ByteString) ref; 664 } 665 } 666 /** 667 * 668 * 669 * <pre> 670 * Required. The content of the text snippet as a string. Up to 250000 671 * characters long. 672 * </pre> 673 * 674 * <code>string content = 1;</code> 675 * 676 * @param value The content to set. 677 * @return This builder for chaining. 678 */ setContent(java.lang.String value)679 public Builder setContent(java.lang.String value) { 680 if (value == null) { 681 throw new NullPointerException(); 682 } 683 content_ = value; 684 bitField0_ |= 0x00000001; 685 onChanged(); 686 return this; 687 } 688 /** 689 * 690 * 691 * <pre> 692 * Required. The content of the text snippet as a string. Up to 250000 693 * characters long. 694 * </pre> 695 * 696 * <code>string content = 1;</code> 697 * 698 * @return This builder for chaining. 699 */ clearContent()700 public Builder clearContent() { 701 content_ = getDefaultInstance().getContent(); 702 bitField0_ = (bitField0_ & ~0x00000001); 703 onChanged(); 704 return this; 705 } 706 /** 707 * 708 * 709 * <pre> 710 * Required. The content of the text snippet as a string. Up to 250000 711 * characters long. 712 * </pre> 713 * 714 * <code>string content = 1;</code> 715 * 716 * @param value The bytes for content to set. 717 * @return This builder for chaining. 718 */ setContentBytes(com.google.protobuf.ByteString value)719 public Builder setContentBytes(com.google.protobuf.ByteString value) { 720 if (value == null) { 721 throw new NullPointerException(); 722 } 723 checkByteStringIsUtf8(value); 724 content_ = value; 725 bitField0_ |= 0x00000001; 726 onChanged(); 727 return this; 728 } 729 730 private java.lang.Object mimeType_ = ""; 731 /** 732 * 733 * 734 * <pre> 735 * Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed 736 * values are "text/html" and "text/plain". If left blank, the format is 737 * automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content]. 738 * </pre> 739 * 740 * <code>string mime_type = 2;</code> 741 * 742 * @return The mimeType. 743 */ getMimeType()744 public java.lang.String getMimeType() { 745 java.lang.Object ref = mimeType_; 746 if (!(ref instanceof java.lang.String)) { 747 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 748 java.lang.String s = bs.toStringUtf8(); 749 mimeType_ = s; 750 return s; 751 } else { 752 return (java.lang.String) ref; 753 } 754 } 755 /** 756 * 757 * 758 * <pre> 759 * Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed 760 * values are "text/html" and "text/plain". If left blank, the format is 761 * automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content]. 762 * </pre> 763 * 764 * <code>string mime_type = 2;</code> 765 * 766 * @return The bytes for mimeType. 767 */ getMimeTypeBytes()768 public com.google.protobuf.ByteString getMimeTypeBytes() { 769 java.lang.Object ref = mimeType_; 770 if (ref instanceof String) { 771 com.google.protobuf.ByteString b = 772 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 773 mimeType_ = b; 774 return b; 775 } else { 776 return (com.google.protobuf.ByteString) ref; 777 } 778 } 779 /** 780 * 781 * 782 * <pre> 783 * Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed 784 * values are "text/html" and "text/plain". If left blank, the format is 785 * automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content]. 786 * </pre> 787 * 788 * <code>string mime_type = 2;</code> 789 * 790 * @param value The mimeType to set. 791 * @return This builder for chaining. 792 */ setMimeType(java.lang.String value)793 public Builder setMimeType(java.lang.String value) { 794 if (value == null) { 795 throw new NullPointerException(); 796 } 797 mimeType_ = value; 798 bitField0_ |= 0x00000002; 799 onChanged(); 800 return this; 801 } 802 /** 803 * 804 * 805 * <pre> 806 * Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed 807 * values are "text/html" and "text/plain". If left blank, the format is 808 * automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content]. 809 * </pre> 810 * 811 * <code>string mime_type = 2;</code> 812 * 813 * @return This builder for chaining. 814 */ clearMimeType()815 public Builder clearMimeType() { 816 mimeType_ = getDefaultInstance().getMimeType(); 817 bitField0_ = (bitField0_ & ~0x00000002); 818 onChanged(); 819 return this; 820 } 821 /** 822 * 823 * 824 * <pre> 825 * Optional. The format of [content][google.cloud.automl.v1.TextSnippet.content]. Currently the only two allowed 826 * values are "text/html" and "text/plain". If left blank, the format is 827 * automatically determined from the type of the uploaded [content][google.cloud.automl.v1.TextSnippet.content]. 828 * </pre> 829 * 830 * <code>string mime_type = 2;</code> 831 * 832 * @param value The bytes for mimeType to set. 833 * @return This builder for chaining. 834 */ setMimeTypeBytes(com.google.protobuf.ByteString value)835 public Builder setMimeTypeBytes(com.google.protobuf.ByteString value) { 836 if (value == null) { 837 throw new NullPointerException(); 838 } 839 checkByteStringIsUtf8(value); 840 mimeType_ = value; 841 bitField0_ |= 0x00000002; 842 onChanged(); 843 return this; 844 } 845 846 private java.lang.Object contentUri_ = ""; 847 /** 848 * 849 * 850 * <pre> 851 * Output only. HTTP URI where you can download the content. 852 * </pre> 853 * 854 * <code>string content_uri = 4;</code> 855 * 856 * @return The contentUri. 857 */ getContentUri()858 public java.lang.String getContentUri() { 859 java.lang.Object ref = contentUri_; 860 if (!(ref instanceof java.lang.String)) { 861 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 862 java.lang.String s = bs.toStringUtf8(); 863 contentUri_ = s; 864 return s; 865 } else { 866 return (java.lang.String) ref; 867 } 868 } 869 /** 870 * 871 * 872 * <pre> 873 * Output only. HTTP URI where you can download the content. 874 * </pre> 875 * 876 * <code>string content_uri = 4;</code> 877 * 878 * @return The bytes for contentUri. 879 */ getContentUriBytes()880 public com.google.protobuf.ByteString getContentUriBytes() { 881 java.lang.Object ref = contentUri_; 882 if (ref instanceof String) { 883 com.google.protobuf.ByteString b = 884 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 885 contentUri_ = b; 886 return b; 887 } else { 888 return (com.google.protobuf.ByteString) ref; 889 } 890 } 891 /** 892 * 893 * 894 * <pre> 895 * Output only. HTTP URI where you can download the content. 896 * </pre> 897 * 898 * <code>string content_uri = 4;</code> 899 * 900 * @param value The contentUri to set. 901 * @return This builder for chaining. 902 */ setContentUri(java.lang.String value)903 public Builder setContentUri(java.lang.String value) { 904 if (value == null) { 905 throw new NullPointerException(); 906 } 907 contentUri_ = value; 908 bitField0_ |= 0x00000004; 909 onChanged(); 910 return this; 911 } 912 /** 913 * 914 * 915 * <pre> 916 * Output only. HTTP URI where you can download the content. 917 * </pre> 918 * 919 * <code>string content_uri = 4;</code> 920 * 921 * @return This builder for chaining. 922 */ clearContentUri()923 public Builder clearContentUri() { 924 contentUri_ = getDefaultInstance().getContentUri(); 925 bitField0_ = (bitField0_ & ~0x00000004); 926 onChanged(); 927 return this; 928 } 929 /** 930 * 931 * 932 * <pre> 933 * Output only. HTTP URI where you can download the content. 934 * </pre> 935 * 936 * <code>string content_uri = 4;</code> 937 * 938 * @param value The bytes for contentUri to set. 939 * @return This builder for chaining. 940 */ setContentUriBytes(com.google.protobuf.ByteString value)941 public Builder setContentUriBytes(com.google.protobuf.ByteString value) { 942 if (value == null) { 943 throw new NullPointerException(); 944 } 945 checkByteStringIsUtf8(value); 946 contentUri_ = value; 947 bitField0_ |= 0x00000004; 948 onChanged(); 949 return this; 950 } 951 952 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)953 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 954 return super.setUnknownFields(unknownFields); 955 } 956 957 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)958 public final Builder mergeUnknownFields( 959 final com.google.protobuf.UnknownFieldSet unknownFields) { 960 return super.mergeUnknownFields(unknownFields); 961 } 962 963 // @@protoc_insertion_point(builder_scope:google.cloud.automl.v1.TextSnippet) 964 } 965 966 // @@protoc_insertion_point(class_scope:google.cloud.automl.v1.TextSnippet) 967 private static final com.google.cloud.automl.v1.TextSnippet DEFAULT_INSTANCE; 968 969 static { 970 DEFAULT_INSTANCE = new com.google.cloud.automl.v1.TextSnippet(); 971 } 972 getDefaultInstance()973 public static com.google.cloud.automl.v1.TextSnippet getDefaultInstance() { 974 return DEFAULT_INSTANCE; 975 } 976 977 private static final com.google.protobuf.Parser<TextSnippet> PARSER = 978 new com.google.protobuf.AbstractParser<TextSnippet>() { 979 @java.lang.Override 980 public TextSnippet parsePartialFrom( 981 com.google.protobuf.CodedInputStream input, 982 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 983 throws com.google.protobuf.InvalidProtocolBufferException { 984 Builder builder = newBuilder(); 985 try { 986 builder.mergeFrom(input, extensionRegistry); 987 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 988 throw e.setUnfinishedMessage(builder.buildPartial()); 989 } catch (com.google.protobuf.UninitializedMessageException e) { 990 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 991 } catch (java.io.IOException e) { 992 throw new com.google.protobuf.InvalidProtocolBufferException(e) 993 .setUnfinishedMessage(builder.buildPartial()); 994 } 995 return builder.buildPartial(); 996 } 997 }; 998 parser()999 public static com.google.protobuf.Parser<TextSnippet> parser() { 1000 return PARSER; 1001 } 1002 1003 @java.lang.Override getParserForType()1004 public com.google.protobuf.Parser<TextSnippet> getParserForType() { 1005 return PARSER; 1006 } 1007 1008 @java.lang.Override getDefaultInstanceForType()1009 public com.google.cloud.automl.v1.TextSnippet getDefaultInstanceForType() { 1010 return DEFAULT_INSTANCE; 1011 } 1012 } 1013