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/vision/v1p4beta1/image_annotator.proto 18 19 package com.google.cloud.vision.v1p4beta1; 20 21 /** 22 * 23 * 24 * <pre> 25 * The type of Google Cloud Vision API detection to perform, and the maximum 26 * number of results to return for that type. Multiple `Feature` objects can 27 * be specified in the `features` list. 28 * </pre> 29 * 30 * Protobuf type {@code google.cloud.vision.v1p4beta1.Feature} 31 */ 32 public final class Feature extends com.google.protobuf.GeneratedMessageV3 33 implements 34 // @@protoc_insertion_point(message_implements:google.cloud.vision.v1p4beta1.Feature) 35 FeatureOrBuilder { 36 private static final long serialVersionUID = 0L; 37 // Use Feature.newBuilder() to construct. Feature(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)38 private Feature(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 39 super(builder); 40 } 41 Feature()42 private Feature() { 43 type_ = 0; 44 model_ = ""; 45 } 46 47 @java.lang.Override 48 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)49 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 50 return new Feature(); 51 } 52 53 @java.lang.Override getUnknownFields()54 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 55 return this.unknownFields; 56 } 57 getDescriptor()58 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 59 return com.google.cloud.vision.v1p4beta1.ImageAnnotatorProto 60 .internal_static_google_cloud_vision_v1p4beta1_Feature_descriptor; 61 } 62 63 @java.lang.Override 64 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()65 internalGetFieldAccessorTable() { 66 return com.google.cloud.vision.v1p4beta1.ImageAnnotatorProto 67 .internal_static_google_cloud_vision_v1p4beta1_Feature_fieldAccessorTable 68 .ensureFieldAccessorsInitialized( 69 com.google.cloud.vision.v1p4beta1.Feature.class, 70 com.google.cloud.vision.v1p4beta1.Feature.Builder.class); 71 } 72 73 /** 74 * 75 * 76 * <pre> 77 * Type of Google Cloud Vision API feature to be extracted. 78 * </pre> 79 * 80 * Protobuf enum {@code google.cloud.vision.v1p4beta1.Feature.Type} 81 */ 82 public enum Type implements com.google.protobuf.ProtocolMessageEnum { 83 /** 84 * 85 * 86 * <pre> 87 * Unspecified feature type. 88 * </pre> 89 * 90 * <code>TYPE_UNSPECIFIED = 0;</code> 91 */ 92 TYPE_UNSPECIFIED(0), 93 /** 94 * 95 * 96 * <pre> 97 * Run face detection. 98 * </pre> 99 * 100 * <code>FACE_DETECTION = 1;</code> 101 */ 102 FACE_DETECTION(1), 103 /** 104 * 105 * 106 * <pre> 107 * Run landmark detection. 108 * </pre> 109 * 110 * <code>LANDMARK_DETECTION = 2;</code> 111 */ 112 LANDMARK_DETECTION(2), 113 /** 114 * 115 * 116 * <pre> 117 * Run logo detection. 118 * </pre> 119 * 120 * <code>LOGO_DETECTION = 3;</code> 121 */ 122 LOGO_DETECTION(3), 123 /** 124 * 125 * 126 * <pre> 127 * Run label detection. 128 * </pre> 129 * 130 * <code>LABEL_DETECTION = 4;</code> 131 */ 132 LABEL_DETECTION(4), 133 /** 134 * 135 * 136 * <pre> 137 * Run text detection / optical character recognition (OCR). Text detection 138 * is optimized for areas of text within a larger image; if the image is 139 * a document, use `DOCUMENT_TEXT_DETECTION` instead. 140 * </pre> 141 * 142 * <code>TEXT_DETECTION = 5;</code> 143 */ 144 TEXT_DETECTION(5), 145 /** 146 * 147 * 148 * <pre> 149 * Run dense text document OCR. Takes precedence when both 150 * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present. 151 * </pre> 152 * 153 * <code>DOCUMENT_TEXT_DETECTION = 11;</code> 154 */ 155 DOCUMENT_TEXT_DETECTION(11), 156 /** 157 * 158 * 159 * <pre> 160 * Run Safe Search to detect potentially unsafe 161 * or undesirable content. 162 * </pre> 163 * 164 * <code>SAFE_SEARCH_DETECTION = 6;</code> 165 */ 166 SAFE_SEARCH_DETECTION(6), 167 /** 168 * 169 * 170 * <pre> 171 * Compute a set of image properties, such as the 172 * image's dominant colors. 173 * </pre> 174 * 175 * <code>IMAGE_PROPERTIES = 7;</code> 176 */ 177 IMAGE_PROPERTIES(7), 178 /** 179 * 180 * 181 * <pre> 182 * Run crop hints. 183 * </pre> 184 * 185 * <code>CROP_HINTS = 9;</code> 186 */ 187 CROP_HINTS(9), 188 /** 189 * 190 * 191 * <pre> 192 * Run web detection. 193 * </pre> 194 * 195 * <code>WEB_DETECTION = 10;</code> 196 */ 197 WEB_DETECTION(10), 198 /** 199 * 200 * 201 * <pre> 202 * Run Product Search. 203 * </pre> 204 * 205 * <code>PRODUCT_SEARCH = 12;</code> 206 */ 207 PRODUCT_SEARCH(12), 208 /** 209 * 210 * 211 * <pre> 212 * Run localizer for object detection. 213 * </pre> 214 * 215 * <code>OBJECT_LOCALIZATION = 19;</code> 216 */ 217 OBJECT_LOCALIZATION(19), 218 UNRECOGNIZED(-1), 219 ; 220 221 /** 222 * 223 * 224 * <pre> 225 * Unspecified feature type. 226 * </pre> 227 * 228 * <code>TYPE_UNSPECIFIED = 0;</code> 229 */ 230 public static final int TYPE_UNSPECIFIED_VALUE = 0; 231 /** 232 * 233 * 234 * <pre> 235 * Run face detection. 236 * </pre> 237 * 238 * <code>FACE_DETECTION = 1;</code> 239 */ 240 public static final int FACE_DETECTION_VALUE = 1; 241 /** 242 * 243 * 244 * <pre> 245 * Run landmark detection. 246 * </pre> 247 * 248 * <code>LANDMARK_DETECTION = 2;</code> 249 */ 250 public static final int LANDMARK_DETECTION_VALUE = 2; 251 /** 252 * 253 * 254 * <pre> 255 * Run logo detection. 256 * </pre> 257 * 258 * <code>LOGO_DETECTION = 3;</code> 259 */ 260 public static final int LOGO_DETECTION_VALUE = 3; 261 /** 262 * 263 * 264 * <pre> 265 * Run label detection. 266 * </pre> 267 * 268 * <code>LABEL_DETECTION = 4;</code> 269 */ 270 public static final int LABEL_DETECTION_VALUE = 4; 271 /** 272 * 273 * 274 * <pre> 275 * Run text detection / optical character recognition (OCR). Text detection 276 * is optimized for areas of text within a larger image; if the image is 277 * a document, use `DOCUMENT_TEXT_DETECTION` instead. 278 * </pre> 279 * 280 * <code>TEXT_DETECTION = 5;</code> 281 */ 282 public static final int TEXT_DETECTION_VALUE = 5; 283 /** 284 * 285 * 286 * <pre> 287 * Run dense text document OCR. Takes precedence when both 288 * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present. 289 * </pre> 290 * 291 * <code>DOCUMENT_TEXT_DETECTION = 11;</code> 292 */ 293 public static final int DOCUMENT_TEXT_DETECTION_VALUE = 11; 294 /** 295 * 296 * 297 * <pre> 298 * Run Safe Search to detect potentially unsafe 299 * or undesirable content. 300 * </pre> 301 * 302 * <code>SAFE_SEARCH_DETECTION = 6;</code> 303 */ 304 public static final int SAFE_SEARCH_DETECTION_VALUE = 6; 305 /** 306 * 307 * 308 * <pre> 309 * Compute a set of image properties, such as the 310 * image's dominant colors. 311 * </pre> 312 * 313 * <code>IMAGE_PROPERTIES = 7;</code> 314 */ 315 public static final int IMAGE_PROPERTIES_VALUE = 7; 316 /** 317 * 318 * 319 * <pre> 320 * Run crop hints. 321 * </pre> 322 * 323 * <code>CROP_HINTS = 9;</code> 324 */ 325 public static final int CROP_HINTS_VALUE = 9; 326 /** 327 * 328 * 329 * <pre> 330 * Run web detection. 331 * </pre> 332 * 333 * <code>WEB_DETECTION = 10;</code> 334 */ 335 public static final int WEB_DETECTION_VALUE = 10; 336 /** 337 * 338 * 339 * <pre> 340 * Run Product Search. 341 * </pre> 342 * 343 * <code>PRODUCT_SEARCH = 12;</code> 344 */ 345 public static final int PRODUCT_SEARCH_VALUE = 12; 346 /** 347 * 348 * 349 * <pre> 350 * Run localizer for object detection. 351 * </pre> 352 * 353 * <code>OBJECT_LOCALIZATION = 19;</code> 354 */ 355 public static final int OBJECT_LOCALIZATION_VALUE = 19; 356 getNumber()357 public final int getNumber() { 358 if (this == UNRECOGNIZED) { 359 throw new java.lang.IllegalArgumentException( 360 "Can't get the number of an unknown enum value."); 361 } 362 return value; 363 } 364 365 /** 366 * @param value The numeric wire value of the corresponding enum entry. 367 * @return The enum associated with the given numeric wire value. 368 * @deprecated Use {@link #forNumber(int)} instead. 369 */ 370 @java.lang.Deprecated valueOf(int value)371 public static Type valueOf(int value) { 372 return forNumber(value); 373 } 374 375 /** 376 * @param value The numeric wire value of the corresponding enum entry. 377 * @return The enum associated with the given numeric wire value. 378 */ forNumber(int value)379 public static Type forNumber(int value) { 380 switch (value) { 381 case 0: 382 return TYPE_UNSPECIFIED; 383 case 1: 384 return FACE_DETECTION; 385 case 2: 386 return LANDMARK_DETECTION; 387 case 3: 388 return LOGO_DETECTION; 389 case 4: 390 return LABEL_DETECTION; 391 case 5: 392 return TEXT_DETECTION; 393 case 11: 394 return DOCUMENT_TEXT_DETECTION; 395 case 6: 396 return SAFE_SEARCH_DETECTION; 397 case 7: 398 return IMAGE_PROPERTIES; 399 case 9: 400 return CROP_HINTS; 401 case 10: 402 return WEB_DETECTION; 403 case 12: 404 return PRODUCT_SEARCH; 405 case 19: 406 return OBJECT_LOCALIZATION; 407 default: 408 return null; 409 } 410 } 411 internalGetValueMap()412 public static com.google.protobuf.Internal.EnumLiteMap<Type> internalGetValueMap() { 413 return internalValueMap; 414 } 415 416 private static final com.google.protobuf.Internal.EnumLiteMap<Type> internalValueMap = 417 new com.google.protobuf.Internal.EnumLiteMap<Type>() { 418 public Type findValueByNumber(int number) { 419 return Type.forNumber(number); 420 } 421 }; 422 getValueDescriptor()423 public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { 424 if (this == UNRECOGNIZED) { 425 throw new java.lang.IllegalStateException( 426 "Can't get the descriptor of an unrecognized enum value."); 427 } 428 return getDescriptor().getValues().get(ordinal()); 429 } 430 getDescriptorForType()431 public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { 432 return getDescriptor(); 433 } 434 getDescriptor()435 public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { 436 return com.google.cloud.vision.v1p4beta1.Feature.getDescriptor().getEnumTypes().get(0); 437 } 438 439 private static final Type[] VALUES = values(); 440 valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)441 public static Type valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { 442 if (desc.getType() != getDescriptor()) { 443 throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); 444 } 445 if (desc.getIndex() == -1) { 446 return UNRECOGNIZED; 447 } 448 return VALUES[desc.getIndex()]; 449 } 450 451 private final int value; 452 Type(int value)453 private Type(int value) { 454 this.value = value; 455 } 456 457 // @@protoc_insertion_point(enum_scope:google.cloud.vision.v1p4beta1.Feature.Type) 458 } 459 460 public static final int TYPE_FIELD_NUMBER = 1; 461 private int type_ = 0; 462 /** 463 * 464 * 465 * <pre> 466 * The feature type. 467 * </pre> 468 * 469 * <code>.google.cloud.vision.v1p4beta1.Feature.Type type = 1;</code> 470 * 471 * @return The enum numeric value on the wire for type. 472 */ 473 @java.lang.Override getTypeValue()474 public int getTypeValue() { 475 return type_; 476 } 477 /** 478 * 479 * 480 * <pre> 481 * The feature type. 482 * </pre> 483 * 484 * <code>.google.cloud.vision.v1p4beta1.Feature.Type type = 1;</code> 485 * 486 * @return The type. 487 */ 488 @java.lang.Override getType()489 public com.google.cloud.vision.v1p4beta1.Feature.Type getType() { 490 com.google.cloud.vision.v1p4beta1.Feature.Type result = 491 com.google.cloud.vision.v1p4beta1.Feature.Type.forNumber(type_); 492 return result == null ? com.google.cloud.vision.v1p4beta1.Feature.Type.UNRECOGNIZED : result; 493 } 494 495 public static final int MAX_RESULTS_FIELD_NUMBER = 2; 496 private int maxResults_ = 0; 497 /** 498 * 499 * 500 * <pre> 501 * Maximum number of results of this type. Does not apply to 502 * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 503 * </pre> 504 * 505 * <code>int32 max_results = 2;</code> 506 * 507 * @return The maxResults. 508 */ 509 @java.lang.Override getMaxResults()510 public int getMaxResults() { 511 return maxResults_; 512 } 513 514 public static final int MODEL_FIELD_NUMBER = 3; 515 516 @SuppressWarnings("serial") 517 private volatile java.lang.Object model_ = ""; 518 /** 519 * 520 * 521 * <pre> 522 * Model to use for the feature. 523 * Supported values: "builtin/stable" (the default if unset) and 524 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 525 * support "builtin/weekly" for the bleeding edge release updated weekly. 526 * </pre> 527 * 528 * <code>string model = 3;</code> 529 * 530 * @return The model. 531 */ 532 @java.lang.Override getModel()533 public java.lang.String getModel() { 534 java.lang.Object ref = model_; 535 if (ref instanceof java.lang.String) { 536 return (java.lang.String) ref; 537 } else { 538 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 539 java.lang.String s = bs.toStringUtf8(); 540 model_ = s; 541 return s; 542 } 543 } 544 /** 545 * 546 * 547 * <pre> 548 * Model to use for the feature. 549 * Supported values: "builtin/stable" (the default if unset) and 550 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 551 * support "builtin/weekly" for the bleeding edge release updated weekly. 552 * </pre> 553 * 554 * <code>string model = 3;</code> 555 * 556 * @return The bytes for model. 557 */ 558 @java.lang.Override getModelBytes()559 public com.google.protobuf.ByteString getModelBytes() { 560 java.lang.Object ref = model_; 561 if (ref instanceof java.lang.String) { 562 com.google.protobuf.ByteString b = 563 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 564 model_ = b; 565 return b; 566 } else { 567 return (com.google.protobuf.ByteString) ref; 568 } 569 } 570 571 private byte memoizedIsInitialized = -1; 572 573 @java.lang.Override isInitialized()574 public final boolean isInitialized() { 575 byte isInitialized = memoizedIsInitialized; 576 if (isInitialized == 1) return true; 577 if (isInitialized == 0) return false; 578 579 memoizedIsInitialized = 1; 580 return true; 581 } 582 583 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)584 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 585 if (type_ != com.google.cloud.vision.v1p4beta1.Feature.Type.TYPE_UNSPECIFIED.getNumber()) { 586 output.writeEnum(1, type_); 587 } 588 if (maxResults_ != 0) { 589 output.writeInt32(2, maxResults_); 590 } 591 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(model_)) { 592 com.google.protobuf.GeneratedMessageV3.writeString(output, 3, model_); 593 } 594 getUnknownFields().writeTo(output); 595 } 596 597 @java.lang.Override getSerializedSize()598 public int getSerializedSize() { 599 int size = memoizedSize; 600 if (size != -1) return size; 601 602 size = 0; 603 if (type_ != com.google.cloud.vision.v1p4beta1.Feature.Type.TYPE_UNSPECIFIED.getNumber()) { 604 size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, type_); 605 } 606 if (maxResults_ != 0) { 607 size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, maxResults_); 608 } 609 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(model_)) { 610 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, model_); 611 } 612 size += getUnknownFields().getSerializedSize(); 613 memoizedSize = size; 614 return size; 615 } 616 617 @java.lang.Override equals(final java.lang.Object obj)618 public boolean equals(final java.lang.Object obj) { 619 if (obj == this) { 620 return true; 621 } 622 if (!(obj instanceof com.google.cloud.vision.v1p4beta1.Feature)) { 623 return super.equals(obj); 624 } 625 com.google.cloud.vision.v1p4beta1.Feature other = 626 (com.google.cloud.vision.v1p4beta1.Feature) obj; 627 628 if (type_ != other.type_) return false; 629 if (getMaxResults() != other.getMaxResults()) return false; 630 if (!getModel().equals(other.getModel())) return false; 631 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 632 return true; 633 } 634 635 @java.lang.Override hashCode()636 public int hashCode() { 637 if (memoizedHashCode != 0) { 638 return memoizedHashCode; 639 } 640 int hash = 41; 641 hash = (19 * hash) + getDescriptor().hashCode(); 642 hash = (37 * hash) + TYPE_FIELD_NUMBER; 643 hash = (53 * hash) + type_; 644 hash = (37 * hash) + MAX_RESULTS_FIELD_NUMBER; 645 hash = (53 * hash) + getMaxResults(); 646 hash = (37 * hash) + MODEL_FIELD_NUMBER; 647 hash = (53 * hash) + getModel().hashCode(); 648 hash = (29 * hash) + getUnknownFields().hashCode(); 649 memoizedHashCode = hash; 650 return hash; 651 } 652 parseFrom(java.nio.ByteBuffer data)653 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom(java.nio.ByteBuffer data) 654 throws com.google.protobuf.InvalidProtocolBufferException { 655 return PARSER.parseFrom(data); 656 } 657 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)658 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom( 659 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 660 throws com.google.protobuf.InvalidProtocolBufferException { 661 return PARSER.parseFrom(data, extensionRegistry); 662 } 663 parseFrom( com.google.protobuf.ByteString data)664 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom( 665 com.google.protobuf.ByteString data) 666 throws com.google.protobuf.InvalidProtocolBufferException { 667 return PARSER.parseFrom(data); 668 } 669 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)670 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom( 671 com.google.protobuf.ByteString data, 672 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 673 throws com.google.protobuf.InvalidProtocolBufferException { 674 return PARSER.parseFrom(data, extensionRegistry); 675 } 676 parseFrom(byte[] data)677 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom(byte[] data) 678 throws com.google.protobuf.InvalidProtocolBufferException { 679 return PARSER.parseFrom(data); 680 } 681 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)682 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom( 683 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 684 throws com.google.protobuf.InvalidProtocolBufferException { 685 return PARSER.parseFrom(data, extensionRegistry); 686 } 687 parseFrom(java.io.InputStream input)688 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom(java.io.InputStream input) 689 throws java.io.IOException { 690 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 691 } 692 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)693 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom( 694 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 695 throws java.io.IOException { 696 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 697 PARSER, input, extensionRegistry); 698 } 699 parseDelimitedFrom( java.io.InputStream input)700 public static com.google.cloud.vision.v1p4beta1.Feature parseDelimitedFrom( 701 java.io.InputStream input) throws java.io.IOException { 702 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 703 } 704 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)705 public static com.google.cloud.vision.v1p4beta1.Feature parseDelimitedFrom( 706 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 707 throws java.io.IOException { 708 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 709 PARSER, input, extensionRegistry); 710 } 711 parseFrom( com.google.protobuf.CodedInputStream input)712 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom( 713 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 714 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 715 } 716 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)717 public static com.google.cloud.vision.v1p4beta1.Feature parseFrom( 718 com.google.protobuf.CodedInputStream input, 719 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 720 throws java.io.IOException { 721 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 722 PARSER, input, extensionRegistry); 723 } 724 725 @java.lang.Override newBuilderForType()726 public Builder newBuilderForType() { 727 return newBuilder(); 728 } 729 newBuilder()730 public static Builder newBuilder() { 731 return DEFAULT_INSTANCE.toBuilder(); 732 } 733 newBuilder(com.google.cloud.vision.v1p4beta1.Feature prototype)734 public static Builder newBuilder(com.google.cloud.vision.v1p4beta1.Feature prototype) { 735 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 736 } 737 738 @java.lang.Override toBuilder()739 public Builder toBuilder() { 740 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 741 } 742 743 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)744 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 745 Builder builder = new Builder(parent); 746 return builder; 747 } 748 /** 749 * 750 * 751 * <pre> 752 * The type of Google Cloud Vision API detection to perform, and the maximum 753 * number of results to return for that type. Multiple `Feature` objects can 754 * be specified in the `features` list. 755 * </pre> 756 * 757 * Protobuf type {@code google.cloud.vision.v1p4beta1.Feature} 758 */ 759 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 760 implements 761 // @@protoc_insertion_point(builder_implements:google.cloud.vision.v1p4beta1.Feature) 762 com.google.cloud.vision.v1p4beta1.FeatureOrBuilder { getDescriptor()763 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 764 return com.google.cloud.vision.v1p4beta1.ImageAnnotatorProto 765 .internal_static_google_cloud_vision_v1p4beta1_Feature_descriptor; 766 } 767 768 @java.lang.Override 769 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()770 internalGetFieldAccessorTable() { 771 return com.google.cloud.vision.v1p4beta1.ImageAnnotatorProto 772 .internal_static_google_cloud_vision_v1p4beta1_Feature_fieldAccessorTable 773 .ensureFieldAccessorsInitialized( 774 com.google.cloud.vision.v1p4beta1.Feature.class, 775 com.google.cloud.vision.v1p4beta1.Feature.Builder.class); 776 } 777 778 // Construct using com.google.cloud.vision.v1p4beta1.Feature.newBuilder() Builder()779 private Builder() {} 780 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)781 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 782 super(parent); 783 } 784 785 @java.lang.Override clear()786 public Builder clear() { 787 super.clear(); 788 bitField0_ = 0; 789 type_ = 0; 790 maxResults_ = 0; 791 model_ = ""; 792 return this; 793 } 794 795 @java.lang.Override getDescriptorForType()796 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 797 return com.google.cloud.vision.v1p4beta1.ImageAnnotatorProto 798 .internal_static_google_cloud_vision_v1p4beta1_Feature_descriptor; 799 } 800 801 @java.lang.Override getDefaultInstanceForType()802 public com.google.cloud.vision.v1p4beta1.Feature getDefaultInstanceForType() { 803 return com.google.cloud.vision.v1p4beta1.Feature.getDefaultInstance(); 804 } 805 806 @java.lang.Override build()807 public com.google.cloud.vision.v1p4beta1.Feature build() { 808 com.google.cloud.vision.v1p4beta1.Feature result = buildPartial(); 809 if (!result.isInitialized()) { 810 throw newUninitializedMessageException(result); 811 } 812 return result; 813 } 814 815 @java.lang.Override buildPartial()816 public com.google.cloud.vision.v1p4beta1.Feature buildPartial() { 817 com.google.cloud.vision.v1p4beta1.Feature result = 818 new com.google.cloud.vision.v1p4beta1.Feature(this); 819 if (bitField0_ != 0) { 820 buildPartial0(result); 821 } 822 onBuilt(); 823 return result; 824 } 825 buildPartial0(com.google.cloud.vision.v1p4beta1.Feature result)826 private void buildPartial0(com.google.cloud.vision.v1p4beta1.Feature result) { 827 int from_bitField0_ = bitField0_; 828 if (((from_bitField0_ & 0x00000001) != 0)) { 829 result.type_ = type_; 830 } 831 if (((from_bitField0_ & 0x00000002) != 0)) { 832 result.maxResults_ = maxResults_; 833 } 834 if (((from_bitField0_ & 0x00000004) != 0)) { 835 result.model_ = model_; 836 } 837 } 838 839 @java.lang.Override clone()840 public Builder clone() { 841 return super.clone(); 842 } 843 844 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)845 public Builder setField( 846 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 847 return super.setField(field, value); 848 } 849 850 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)851 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 852 return super.clearField(field); 853 } 854 855 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)856 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 857 return super.clearOneof(oneof); 858 } 859 860 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)861 public Builder setRepeatedField( 862 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 863 return super.setRepeatedField(field, index, value); 864 } 865 866 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)867 public Builder addRepeatedField( 868 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 869 return super.addRepeatedField(field, value); 870 } 871 872 @java.lang.Override mergeFrom(com.google.protobuf.Message other)873 public Builder mergeFrom(com.google.protobuf.Message other) { 874 if (other instanceof com.google.cloud.vision.v1p4beta1.Feature) { 875 return mergeFrom((com.google.cloud.vision.v1p4beta1.Feature) other); 876 } else { 877 super.mergeFrom(other); 878 return this; 879 } 880 } 881 mergeFrom(com.google.cloud.vision.v1p4beta1.Feature other)882 public Builder mergeFrom(com.google.cloud.vision.v1p4beta1.Feature other) { 883 if (other == com.google.cloud.vision.v1p4beta1.Feature.getDefaultInstance()) return this; 884 if (other.type_ != 0) { 885 setTypeValue(other.getTypeValue()); 886 } 887 if (other.getMaxResults() != 0) { 888 setMaxResults(other.getMaxResults()); 889 } 890 if (!other.getModel().isEmpty()) { 891 model_ = other.model_; 892 bitField0_ |= 0x00000004; 893 onChanged(); 894 } 895 this.mergeUnknownFields(other.getUnknownFields()); 896 onChanged(); 897 return this; 898 } 899 900 @java.lang.Override isInitialized()901 public final boolean isInitialized() { 902 return true; 903 } 904 905 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)906 public Builder mergeFrom( 907 com.google.protobuf.CodedInputStream input, 908 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 909 throws java.io.IOException { 910 if (extensionRegistry == null) { 911 throw new java.lang.NullPointerException(); 912 } 913 try { 914 boolean done = false; 915 while (!done) { 916 int tag = input.readTag(); 917 switch (tag) { 918 case 0: 919 done = true; 920 break; 921 case 8: 922 { 923 type_ = input.readEnum(); 924 bitField0_ |= 0x00000001; 925 break; 926 } // case 8 927 case 16: 928 { 929 maxResults_ = input.readInt32(); 930 bitField0_ |= 0x00000002; 931 break; 932 } // case 16 933 case 26: 934 { 935 model_ = input.readStringRequireUtf8(); 936 bitField0_ |= 0x00000004; 937 break; 938 } // case 26 939 default: 940 { 941 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 942 done = true; // was an endgroup tag 943 } 944 break; 945 } // default: 946 } // switch (tag) 947 } // while (!done) 948 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 949 throw e.unwrapIOException(); 950 } finally { 951 onChanged(); 952 } // finally 953 return this; 954 } 955 956 private int bitField0_; 957 958 private int type_ = 0; 959 /** 960 * 961 * 962 * <pre> 963 * The feature type. 964 * </pre> 965 * 966 * <code>.google.cloud.vision.v1p4beta1.Feature.Type type = 1;</code> 967 * 968 * @return The enum numeric value on the wire for type. 969 */ 970 @java.lang.Override getTypeValue()971 public int getTypeValue() { 972 return type_; 973 } 974 /** 975 * 976 * 977 * <pre> 978 * The feature type. 979 * </pre> 980 * 981 * <code>.google.cloud.vision.v1p4beta1.Feature.Type type = 1;</code> 982 * 983 * @param value The enum numeric value on the wire for type to set. 984 * @return This builder for chaining. 985 */ setTypeValue(int value)986 public Builder setTypeValue(int value) { 987 type_ = value; 988 bitField0_ |= 0x00000001; 989 onChanged(); 990 return this; 991 } 992 /** 993 * 994 * 995 * <pre> 996 * The feature type. 997 * </pre> 998 * 999 * <code>.google.cloud.vision.v1p4beta1.Feature.Type type = 1;</code> 1000 * 1001 * @return The type. 1002 */ 1003 @java.lang.Override getType()1004 public com.google.cloud.vision.v1p4beta1.Feature.Type getType() { 1005 com.google.cloud.vision.v1p4beta1.Feature.Type result = 1006 com.google.cloud.vision.v1p4beta1.Feature.Type.forNumber(type_); 1007 return result == null ? com.google.cloud.vision.v1p4beta1.Feature.Type.UNRECOGNIZED : result; 1008 } 1009 /** 1010 * 1011 * 1012 * <pre> 1013 * The feature type. 1014 * </pre> 1015 * 1016 * <code>.google.cloud.vision.v1p4beta1.Feature.Type type = 1;</code> 1017 * 1018 * @param value The type to set. 1019 * @return This builder for chaining. 1020 */ setType(com.google.cloud.vision.v1p4beta1.Feature.Type value)1021 public Builder setType(com.google.cloud.vision.v1p4beta1.Feature.Type value) { 1022 if (value == null) { 1023 throw new NullPointerException(); 1024 } 1025 bitField0_ |= 0x00000001; 1026 type_ = value.getNumber(); 1027 onChanged(); 1028 return this; 1029 } 1030 /** 1031 * 1032 * 1033 * <pre> 1034 * The feature type. 1035 * </pre> 1036 * 1037 * <code>.google.cloud.vision.v1p4beta1.Feature.Type type = 1;</code> 1038 * 1039 * @return This builder for chaining. 1040 */ clearType()1041 public Builder clearType() { 1042 bitField0_ = (bitField0_ & ~0x00000001); 1043 type_ = 0; 1044 onChanged(); 1045 return this; 1046 } 1047 1048 private int maxResults_; 1049 /** 1050 * 1051 * 1052 * <pre> 1053 * Maximum number of results of this type. Does not apply to 1054 * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 1055 * </pre> 1056 * 1057 * <code>int32 max_results = 2;</code> 1058 * 1059 * @return The maxResults. 1060 */ 1061 @java.lang.Override getMaxResults()1062 public int getMaxResults() { 1063 return maxResults_; 1064 } 1065 /** 1066 * 1067 * 1068 * <pre> 1069 * Maximum number of results of this type. Does not apply to 1070 * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 1071 * </pre> 1072 * 1073 * <code>int32 max_results = 2;</code> 1074 * 1075 * @param value The maxResults to set. 1076 * @return This builder for chaining. 1077 */ setMaxResults(int value)1078 public Builder setMaxResults(int value) { 1079 1080 maxResults_ = value; 1081 bitField0_ |= 0x00000002; 1082 onChanged(); 1083 return this; 1084 } 1085 /** 1086 * 1087 * 1088 * <pre> 1089 * Maximum number of results of this type. Does not apply to 1090 * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 1091 * </pre> 1092 * 1093 * <code>int32 max_results = 2;</code> 1094 * 1095 * @return This builder for chaining. 1096 */ clearMaxResults()1097 public Builder clearMaxResults() { 1098 bitField0_ = (bitField0_ & ~0x00000002); 1099 maxResults_ = 0; 1100 onChanged(); 1101 return this; 1102 } 1103 1104 private java.lang.Object model_ = ""; 1105 /** 1106 * 1107 * 1108 * <pre> 1109 * Model to use for the feature. 1110 * Supported values: "builtin/stable" (the default if unset) and 1111 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1112 * support "builtin/weekly" for the bleeding edge release updated weekly. 1113 * </pre> 1114 * 1115 * <code>string model = 3;</code> 1116 * 1117 * @return The model. 1118 */ getModel()1119 public java.lang.String getModel() { 1120 java.lang.Object ref = model_; 1121 if (!(ref instanceof java.lang.String)) { 1122 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1123 java.lang.String s = bs.toStringUtf8(); 1124 model_ = s; 1125 return s; 1126 } else { 1127 return (java.lang.String) ref; 1128 } 1129 } 1130 /** 1131 * 1132 * 1133 * <pre> 1134 * Model to use for the feature. 1135 * Supported values: "builtin/stable" (the default if unset) and 1136 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1137 * support "builtin/weekly" for the bleeding edge release updated weekly. 1138 * </pre> 1139 * 1140 * <code>string model = 3;</code> 1141 * 1142 * @return The bytes for model. 1143 */ getModelBytes()1144 public com.google.protobuf.ByteString getModelBytes() { 1145 java.lang.Object ref = model_; 1146 if (ref instanceof String) { 1147 com.google.protobuf.ByteString b = 1148 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1149 model_ = b; 1150 return b; 1151 } else { 1152 return (com.google.protobuf.ByteString) ref; 1153 } 1154 } 1155 /** 1156 * 1157 * 1158 * <pre> 1159 * Model to use for the feature. 1160 * Supported values: "builtin/stable" (the default if unset) and 1161 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1162 * support "builtin/weekly" for the bleeding edge release updated weekly. 1163 * </pre> 1164 * 1165 * <code>string model = 3;</code> 1166 * 1167 * @param value The model to set. 1168 * @return This builder for chaining. 1169 */ setModel(java.lang.String value)1170 public Builder setModel(java.lang.String value) { 1171 if (value == null) { 1172 throw new NullPointerException(); 1173 } 1174 model_ = value; 1175 bitField0_ |= 0x00000004; 1176 onChanged(); 1177 return this; 1178 } 1179 /** 1180 * 1181 * 1182 * <pre> 1183 * Model to use for the feature. 1184 * Supported values: "builtin/stable" (the default if unset) and 1185 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1186 * support "builtin/weekly" for the bleeding edge release updated weekly. 1187 * </pre> 1188 * 1189 * <code>string model = 3;</code> 1190 * 1191 * @return This builder for chaining. 1192 */ clearModel()1193 public Builder clearModel() { 1194 model_ = getDefaultInstance().getModel(); 1195 bitField0_ = (bitField0_ & ~0x00000004); 1196 onChanged(); 1197 return this; 1198 } 1199 /** 1200 * 1201 * 1202 * <pre> 1203 * Model to use for the feature. 1204 * Supported values: "builtin/stable" (the default if unset) and 1205 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1206 * support "builtin/weekly" for the bleeding edge release updated weekly. 1207 * </pre> 1208 * 1209 * <code>string model = 3;</code> 1210 * 1211 * @param value The bytes for model to set. 1212 * @return This builder for chaining. 1213 */ setModelBytes(com.google.protobuf.ByteString value)1214 public Builder setModelBytes(com.google.protobuf.ByteString value) { 1215 if (value == null) { 1216 throw new NullPointerException(); 1217 } 1218 checkByteStringIsUtf8(value); 1219 model_ = value; 1220 bitField0_ |= 0x00000004; 1221 onChanged(); 1222 return this; 1223 } 1224 1225 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1226 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 1227 return super.setUnknownFields(unknownFields); 1228 } 1229 1230 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1231 public final Builder mergeUnknownFields( 1232 final com.google.protobuf.UnknownFieldSet unknownFields) { 1233 return super.mergeUnknownFields(unknownFields); 1234 } 1235 1236 // @@protoc_insertion_point(builder_scope:google.cloud.vision.v1p4beta1.Feature) 1237 } 1238 1239 // @@protoc_insertion_point(class_scope:google.cloud.vision.v1p4beta1.Feature) 1240 private static final com.google.cloud.vision.v1p4beta1.Feature DEFAULT_INSTANCE; 1241 1242 static { 1243 DEFAULT_INSTANCE = new com.google.cloud.vision.v1p4beta1.Feature(); 1244 } 1245 getDefaultInstance()1246 public static com.google.cloud.vision.v1p4beta1.Feature getDefaultInstance() { 1247 return DEFAULT_INSTANCE; 1248 } 1249 1250 private static final com.google.protobuf.Parser<Feature> PARSER = 1251 new com.google.protobuf.AbstractParser<Feature>() { 1252 @java.lang.Override 1253 public Feature parsePartialFrom( 1254 com.google.protobuf.CodedInputStream input, 1255 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1256 throws com.google.protobuf.InvalidProtocolBufferException { 1257 Builder builder = newBuilder(); 1258 try { 1259 builder.mergeFrom(input, extensionRegistry); 1260 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1261 throw e.setUnfinishedMessage(builder.buildPartial()); 1262 } catch (com.google.protobuf.UninitializedMessageException e) { 1263 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 1264 } catch (java.io.IOException e) { 1265 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1266 .setUnfinishedMessage(builder.buildPartial()); 1267 } 1268 return builder.buildPartial(); 1269 } 1270 }; 1271 parser()1272 public static com.google.protobuf.Parser<Feature> parser() { 1273 return PARSER; 1274 } 1275 1276 @java.lang.Override getParserForType()1277 public com.google.protobuf.Parser<Feature> getParserForType() { 1278 return PARSER; 1279 } 1280 1281 @java.lang.Override getDefaultInstanceForType()1282 public com.google.cloud.vision.v1p4beta1.Feature getDefaultInstanceForType() { 1283 return DEFAULT_INSTANCE; 1284 } 1285 } 1286