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