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/v1/image_annotator.proto 18 19 package com.google.cloud.vision.v1; 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.v1.Feature} 31 */ 32 public final class Feature extends com.google.protobuf.GeneratedMessageV3 33 implements 34 // @@protoc_insertion_point(message_implements:google.cloud.vision.v1.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.v1.ImageAnnotatorProto 60 .internal_static_google_cloud_vision_v1_Feature_descriptor; 61 } 62 63 @java.lang.Override 64 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()65 internalGetFieldAccessorTable() { 66 return com.google.cloud.vision.v1.ImageAnnotatorProto 67 .internal_static_google_cloud_vision_v1_Feature_fieldAccessorTable 68 .ensureFieldAccessorsInitialized( 69 com.google.cloud.vision.v1.Feature.class, 70 com.google.cloud.vision.v1.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.v1.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.v1.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.v1.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.v1.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.v1.Feature.Type type = 1;</code> 485 * 486 * @return The type. 487 */ 488 @java.lang.Override getType()489 public com.google.cloud.vision.v1.Feature.Type getType() { 490 com.google.cloud.vision.v1.Feature.Type result = 491 com.google.cloud.vision.v1.Feature.Type.forNumber(type_); 492 return result == null ? com.google.cloud.vision.v1.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.v1.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.v1.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.v1.Feature)) { 623 return super.equals(obj); 624 } 625 com.google.cloud.vision.v1.Feature other = (com.google.cloud.vision.v1.Feature) obj; 626 627 if (type_ != other.type_) return false; 628 if (getMaxResults() != other.getMaxResults()) return false; 629 if (!getModel().equals(other.getModel())) return false; 630 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 631 return true; 632 } 633 634 @java.lang.Override hashCode()635 public int hashCode() { 636 if (memoizedHashCode != 0) { 637 return memoizedHashCode; 638 } 639 int hash = 41; 640 hash = (19 * hash) + getDescriptor().hashCode(); 641 hash = (37 * hash) + TYPE_FIELD_NUMBER; 642 hash = (53 * hash) + type_; 643 hash = (37 * hash) + MAX_RESULTS_FIELD_NUMBER; 644 hash = (53 * hash) + getMaxResults(); 645 hash = (37 * hash) + MODEL_FIELD_NUMBER; 646 hash = (53 * hash) + getModel().hashCode(); 647 hash = (29 * hash) + getUnknownFields().hashCode(); 648 memoizedHashCode = hash; 649 return hash; 650 } 651 parseFrom(java.nio.ByteBuffer data)652 public static com.google.cloud.vision.v1.Feature parseFrom(java.nio.ByteBuffer data) 653 throws com.google.protobuf.InvalidProtocolBufferException { 654 return PARSER.parseFrom(data); 655 } 656 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)657 public static com.google.cloud.vision.v1.Feature parseFrom( 658 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 659 throws com.google.protobuf.InvalidProtocolBufferException { 660 return PARSER.parseFrom(data, extensionRegistry); 661 } 662 parseFrom(com.google.protobuf.ByteString data)663 public static com.google.cloud.vision.v1.Feature parseFrom(com.google.protobuf.ByteString data) 664 throws com.google.protobuf.InvalidProtocolBufferException { 665 return PARSER.parseFrom(data); 666 } 667 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)668 public static com.google.cloud.vision.v1.Feature parseFrom( 669 com.google.protobuf.ByteString data, 670 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 671 throws com.google.protobuf.InvalidProtocolBufferException { 672 return PARSER.parseFrom(data, extensionRegistry); 673 } 674 parseFrom(byte[] data)675 public static com.google.cloud.vision.v1.Feature parseFrom(byte[] data) 676 throws com.google.protobuf.InvalidProtocolBufferException { 677 return PARSER.parseFrom(data); 678 } 679 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)680 public static com.google.cloud.vision.v1.Feature parseFrom( 681 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 682 throws com.google.protobuf.InvalidProtocolBufferException { 683 return PARSER.parseFrom(data, extensionRegistry); 684 } 685 parseFrom(java.io.InputStream input)686 public static com.google.cloud.vision.v1.Feature parseFrom(java.io.InputStream input) 687 throws java.io.IOException { 688 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 689 } 690 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)691 public static com.google.cloud.vision.v1.Feature parseFrom( 692 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 693 throws java.io.IOException { 694 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 695 PARSER, input, extensionRegistry); 696 } 697 parseDelimitedFrom(java.io.InputStream input)698 public static com.google.cloud.vision.v1.Feature parseDelimitedFrom(java.io.InputStream input) 699 throws java.io.IOException { 700 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 701 } 702 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)703 public static com.google.cloud.vision.v1.Feature parseDelimitedFrom( 704 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 705 throws java.io.IOException { 706 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 707 PARSER, input, extensionRegistry); 708 } 709 parseFrom( com.google.protobuf.CodedInputStream input)710 public static com.google.cloud.vision.v1.Feature parseFrom( 711 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 712 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 713 } 714 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)715 public static com.google.cloud.vision.v1.Feature parseFrom( 716 com.google.protobuf.CodedInputStream input, 717 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 718 throws java.io.IOException { 719 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 720 PARSER, input, extensionRegistry); 721 } 722 723 @java.lang.Override newBuilderForType()724 public Builder newBuilderForType() { 725 return newBuilder(); 726 } 727 newBuilder()728 public static Builder newBuilder() { 729 return DEFAULT_INSTANCE.toBuilder(); 730 } 731 newBuilder(com.google.cloud.vision.v1.Feature prototype)732 public static Builder newBuilder(com.google.cloud.vision.v1.Feature prototype) { 733 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 734 } 735 736 @java.lang.Override toBuilder()737 public Builder toBuilder() { 738 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 739 } 740 741 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)742 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 743 Builder builder = new Builder(parent); 744 return builder; 745 } 746 /** 747 * 748 * 749 * <pre> 750 * The type of Google Cloud Vision API detection to perform, and the maximum 751 * number of results to return for that type. Multiple `Feature` objects can 752 * be specified in the `features` list. 753 * </pre> 754 * 755 * Protobuf type {@code google.cloud.vision.v1.Feature} 756 */ 757 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 758 implements 759 // @@protoc_insertion_point(builder_implements:google.cloud.vision.v1.Feature) 760 com.google.cloud.vision.v1.FeatureOrBuilder { getDescriptor()761 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 762 return com.google.cloud.vision.v1.ImageAnnotatorProto 763 .internal_static_google_cloud_vision_v1_Feature_descriptor; 764 } 765 766 @java.lang.Override 767 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()768 internalGetFieldAccessorTable() { 769 return com.google.cloud.vision.v1.ImageAnnotatorProto 770 .internal_static_google_cloud_vision_v1_Feature_fieldAccessorTable 771 .ensureFieldAccessorsInitialized( 772 com.google.cloud.vision.v1.Feature.class, 773 com.google.cloud.vision.v1.Feature.Builder.class); 774 } 775 776 // Construct using com.google.cloud.vision.v1.Feature.newBuilder() Builder()777 private Builder() {} 778 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)779 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 780 super(parent); 781 } 782 783 @java.lang.Override clear()784 public Builder clear() { 785 super.clear(); 786 bitField0_ = 0; 787 type_ = 0; 788 maxResults_ = 0; 789 model_ = ""; 790 return this; 791 } 792 793 @java.lang.Override getDescriptorForType()794 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 795 return com.google.cloud.vision.v1.ImageAnnotatorProto 796 .internal_static_google_cloud_vision_v1_Feature_descriptor; 797 } 798 799 @java.lang.Override getDefaultInstanceForType()800 public com.google.cloud.vision.v1.Feature getDefaultInstanceForType() { 801 return com.google.cloud.vision.v1.Feature.getDefaultInstance(); 802 } 803 804 @java.lang.Override build()805 public com.google.cloud.vision.v1.Feature build() { 806 com.google.cloud.vision.v1.Feature result = buildPartial(); 807 if (!result.isInitialized()) { 808 throw newUninitializedMessageException(result); 809 } 810 return result; 811 } 812 813 @java.lang.Override buildPartial()814 public com.google.cloud.vision.v1.Feature buildPartial() { 815 com.google.cloud.vision.v1.Feature result = new com.google.cloud.vision.v1.Feature(this); 816 if (bitField0_ != 0) { 817 buildPartial0(result); 818 } 819 onBuilt(); 820 return result; 821 } 822 buildPartial0(com.google.cloud.vision.v1.Feature result)823 private void buildPartial0(com.google.cloud.vision.v1.Feature result) { 824 int from_bitField0_ = bitField0_; 825 if (((from_bitField0_ & 0x00000001) != 0)) { 826 result.type_ = type_; 827 } 828 if (((from_bitField0_ & 0x00000002) != 0)) { 829 result.maxResults_ = maxResults_; 830 } 831 if (((from_bitField0_ & 0x00000004) != 0)) { 832 result.model_ = model_; 833 } 834 } 835 836 @java.lang.Override clone()837 public Builder clone() { 838 return super.clone(); 839 } 840 841 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)842 public Builder setField( 843 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 844 return super.setField(field, value); 845 } 846 847 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)848 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 849 return super.clearField(field); 850 } 851 852 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)853 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 854 return super.clearOneof(oneof); 855 } 856 857 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)858 public Builder setRepeatedField( 859 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 860 return super.setRepeatedField(field, index, value); 861 } 862 863 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)864 public Builder addRepeatedField( 865 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 866 return super.addRepeatedField(field, value); 867 } 868 869 @java.lang.Override mergeFrom(com.google.protobuf.Message other)870 public Builder mergeFrom(com.google.protobuf.Message other) { 871 if (other instanceof com.google.cloud.vision.v1.Feature) { 872 return mergeFrom((com.google.cloud.vision.v1.Feature) other); 873 } else { 874 super.mergeFrom(other); 875 return this; 876 } 877 } 878 mergeFrom(com.google.cloud.vision.v1.Feature other)879 public Builder mergeFrom(com.google.cloud.vision.v1.Feature other) { 880 if (other == com.google.cloud.vision.v1.Feature.getDefaultInstance()) return this; 881 if (other.type_ != 0) { 882 setTypeValue(other.getTypeValue()); 883 } 884 if (other.getMaxResults() != 0) { 885 setMaxResults(other.getMaxResults()); 886 } 887 if (!other.getModel().isEmpty()) { 888 model_ = other.model_; 889 bitField0_ |= 0x00000004; 890 onChanged(); 891 } 892 this.mergeUnknownFields(other.getUnknownFields()); 893 onChanged(); 894 return this; 895 } 896 897 @java.lang.Override isInitialized()898 public final boolean isInitialized() { 899 return true; 900 } 901 902 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)903 public Builder mergeFrom( 904 com.google.protobuf.CodedInputStream input, 905 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 906 throws java.io.IOException { 907 if (extensionRegistry == null) { 908 throw new java.lang.NullPointerException(); 909 } 910 try { 911 boolean done = false; 912 while (!done) { 913 int tag = input.readTag(); 914 switch (tag) { 915 case 0: 916 done = true; 917 break; 918 case 8: 919 { 920 type_ = input.readEnum(); 921 bitField0_ |= 0x00000001; 922 break; 923 } // case 8 924 case 16: 925 { 926 maxResults_ = input.readInt32(); 927 bitField0_ |= 0x00000002; 928 break; 929 } // case 16 930 case 26: 931 { 932 model_ = input.readStringRequireUtf8(); 933 bitField0_ |= 0x00000004; 934 break; 935 } // case 26 936 default: 937 { 938 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 939 done = true; // was an endgroup tag 940 } 941 break; 942 } // default: 943 } // switch (tag) 944 } // while (!done) 945 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 946 throw e.unwrapIOException(); 947 } finally { 948 onChanged(); 949 } // finally 950 return this; 951 } 952 953 private int bitField0_; 954 955 private int type_ = 0; 956 /** 957 * 958 * 959 * <pre> 960 * The feature type. 961 * </pre> 962 * 963 * <code>.google.cloud.vision.v1.Feature.Type type = 1;</code> 964 * 965 * @return The enum numeric value on the wire for type. 966 */ 967 @java.lang.Override getTypeValue()968 public int getTypeValue() { 969 return type_; 970 } 971 /** 972 * 973 * 974 * <pre> 975 * The feature type. 976 * </pre> 977 * 978 * <code>.google.cloud.vision.v1.Feature.Type type = 1;</code> 979 * 980 * @param value The enum numeric value on the wire for type to set. 981 * @return This builder for chaining. 982 */ setTypeValue(int value)983 public Builder setTypeValue(int value) { 984 type_ = value; 985 bitField0_ |= 0x00000001; 986 onChanged(); 987 return this; 988 } 989 /** 990 * 991 * 992 * <pre> 993 * The feature type. 994 * </pre> 995 * 996 * <code>.google.cloud.vision.v1.Feature.Type type = 1;</code> 997 * 998 * @return The type. 999 */ 1000 @java.lang.Override getType()1001 public com.google.cloud.vision.v1.Feature.Type getType() { 1002 com.google.cloud.vision.v1.Feature.Type result = 1003 com.google.cloud.vision.v1.Feature.Type.forNumber(type_); 1004 return result == null ? com.google.cloud.vision.v1.Feature.Type.UNRECOGNIZED : result; 1005 } 1006 /** 1007 * 1008 * 1009 * <pre> 1010 * The feature type. 1011 * </pre> 1012 * 1013 * <code>.google.cloud.vision.v1.Feature.Type type = 1;</code> 1014 * 1015 * @param value The type to set. 1016 * @return This builder for chaining. 1017 */ setType(com.google.cloud.vision.v1.Feature.Type value)1018 public Builder setType(com.google.cloud.vision.v1.Feature.Type value) { 1019 if (value == null) { 1020 throw new NullPointerException(); 1021 } 1022 bitField0_ |= 0x00000001; 1023 type_ = value.getNumber(); 1024 onChanged(); 1025 return this; 1026 } 1027 /** 1028 * 1029 * 1030 * <pre> 1031 * The feature type. 1032 * </pre> 1033 * 1034 * <code>.google.cloud.vision.v1.Feature.Type type = 1;</code> 1035 * 1036 * @return This builder for chaining. 1037 */ clearType()1038 public Builder clearType() { 1039 bitField0_ = (bitField0_ & ~0x00000001); 1040 type_ = 0; 1041 onChanged(); 1042 return this; 1043 } 1044 1045 private int maxResults_; 1046 /** 1047 * 1048 * 1049 * <pre> 1050 * Maximum number of results of this type. Does not apply to 1051 * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 1052 * </pre> 1053 * 1054 * <code>int32 max_results = 2;</code> 1055 * 1056 * @return The maxResults. 1057 */ 1058 @java.lang.Override getMaxResults()1059 public int getMaxResults() { 1060 return maxResults_; 1061 } 1062 /** 1063 * 1064 * 1065 * <pre> 1066 * Maximum number of results of this type. Does not apply to 1067 * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 1068 * </pre> 1069 * 1070 * <code>int32 max_results = 2;</code> 1071 * 1072 * @param value The maxResults to set. 1073 * @return This builder for chaining. 1074 */ setMaxResults(int value)1075 public Builder setMaxResults(int value) { 1076 1077 maxResults_ = value; 1078 bitField0_ |= 0x00000002; 1079 onChanged(); 1080 return this; 1081 } 1082 /** 1083 * 1084 * 1085 * <pre> 1086 * Maximum number of results of this type. Does not apply to 1087 * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. 1088 * </pre> 1089 * 1090 * <code>int32 max_results = 2;</code> 1091 * 1092 * @return This builder for chaining. 1093 */ clearMaxResults()1094 public Builder clearMaxResults() { 1095 bitField0_ = (bitField0_ & ~0x00000002); 1096 maxResults_ = 0; 1097 onChanged(); 1098 return this; 1099 } 1100 1101 private java.lang.Object model_ = ""; 1102 /** 1103 * 1104 * 1105 * <pre> 1106 * Model to use for the feature. 1107 * Supported values: "builtin/stable" (the default if unset) and 1108 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1109 * support "builtin/weekly" for the bleeding edge release updated weekly. 1110 * </pre> 1111 * 1112 * <code>string model = 3;</code> 1113 * 1114 * @return The model. 1115 */ getModel()1116 public java.lang.String getModel() { 1117 java.lang.Object ref = model_; 1118 if (!(ref instanceof java.lang.String)) { 1119 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1120 java.lang.String s = bs.toStringUtf8(); 1121 model_ = s; 1122 return s; 1123 } else { 1124 return (java.lang.String) ref; 1125 } 1126 } 1127 /** 1128 * 1129 * 1130 * <pre> 1131 * Model to use for the feature. 1132 * Supported values: "builtin/stable" (the default if unset) and 1133 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1134 * support "builtin/weekly" for the bleeding edge release updated weekly. 1135 * </pre> 1136 * 1137 * <code>string model = 3;</code> 1138 * 1139 * @return The bytes for model. 1140 */ getModelBytes()1141 public com.google.protobuf.ByteString getModelBytes() { 1142 java.lang.Object ref = model_; 1143 if (ref instanceof String) { 1144 com.google.protobuf.ByteString b = 1145 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1146 model_ = b; 1147 return b; 1148 } else { 1149 return (com.google.protobuf.ByteString) ref; 1150 } 1151 } 1152 /** 1153 * 1154 * 1155 * <pre> 1156 * Model to use for the feature. 1157 * Supported values: "builtin/stable" (the default if unset) and 1158 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1159 * support "builtin/weekly" for the bleeding edge release updated weekly. 1160 * </pre> 1161 * 1162 * <code>string model = 3;</code> 1163 * 1164 * @param value The model to set. 1165 * @return This builder for chaining. 1166 */ setModel(java.lang.String value)1167 public Builder setModel(java.lang.String value) { 1168 if (value == null) { 1169 throw new NullPointerException(); 1170 } 1171 model_ = value; 1172 bitField0_ |= 0x00000004; 1173 onChanged(); 1174 return this; 1175 } 1176 /** 1177 * 1178 * 1179 * <pre> 1180 * Model to use for the feature. 1181 * Supported values: "builtin/stable" (the default if unset) and 1182 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1183 * support "builtin/weekly" for the bleeding edge release updated weekly. 1184 * </pre> 1185 * 1186 * <code>string model = 3;</code> 1187 * 1188 * @return This builder for chaining. 1189 */ clearModel()1190 public Builder clearModel() { 1191 model_ = getDefaultInstance().getModel(); 1192 bitField0_ = (bitField0_ & ~0x00000004); 1193 onChanged(); 1194 return this; 1195 } 1196 /** 1197 * 1198 * 1199 * <pre> 1200 * Model to use for the feature. 1201 * Supported values: "builtin/stable" (the default if unset) and 1202 * "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also 1203 * support "builtin/weekly" for the bleeding edge release updated weekly. 1204 * </pre> 1205 * 1206 * <code>string model = 3;</code> 1207 * 1208 * @param value The bytes for model to set. 1209 * @return This builder for chaining. 1210 */ setModelBytes(com.google.protobuf.ByteString value)1211 public Builder setModelBytes(com.google.protobuf.ByteString value) { 1212 if (value == null) { 1213 throw new NullPointerException(); 1214 } 1215 checkByteStringIsUtf8(value); 1216 model_ = value; 1217 bitField0_ |= 0x00000004; 1218 onChanged(); 1219 return this; 1220 } 1221 1222 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1223 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 1224 return super.setUnknownFields(unknownFields); 1225 } 1226 1227 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1228 public final Builder mergeUnknownFields( 1229 final com.google.protobuf.UnknownFieldSet unknownFields) { 1230 return super.mergeUnknownFields(unknownFields); 1231 } 1232 1233 // @@protoc_insertion_point(builder_scope:google.cloud.vision.v1.Feature) 1234 } 1235 1236 // @@protoc_insertion_point(class_scope:google.cloud.vision.v1.Feature) 1237 private static final com.google.cloud.vision.v1.Feature DEFAULT_INSTANCE; 1238 1239 static { 1240 DEFAULT_INSTANCE = new com.google.cloud.vision.v1.Feature(); 1241 } 1242 getDefaultInstance()1243 public static com.google.cloud.vision.v1.Feature getDefaultInstance() { 1244 return DEFAULT_INSTANCE; 1245 } 1246 1247 private static final com.google.protobuf.Parser<Feature> PARSER = 1248 new com.google.protobuf.AbstractParser<Feature>() { 1249 @java.lang.Override 1250 public Feature parsePartialFrom( 1251 com.google.protobuf.CodedInputStream input, 1252 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1253 throws com.google.protobuf.InvalidProtocolBufferException { 1254 Builder builder = newBuilder(); 1255 try { 1256 builder.mergeFrom(input, extensionRegistry); 1257 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1258 throw e.setUnfinishedMessage(builder.buildPartial()); 1259 } catch (com.google.protobuf.UninitializedMessageException e) { 1260 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 1261 } catch (java.io.IOException e) { 1262 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1263 .setUnfinishedMessage(builder.buildPartial()); 1264 } 1265 return builder.buildPartial(); 1266 } 1267 }; 1268 parser()1269 public static com.google.protobuf.Parser<Feature> parser() { 1270 return PARSER; 1271 } 1272 1273 @java.lang.Override getParserForType()1274 public com.google.protobuf.Parser<Feature> getParserForType() { 1275 return PARSER; 1276 } 1277 1278 @java.lang.Override getDefaultInstanceForType()1279 public com.google.cloud.vision.v1.Feature getDefaultInstanceForType() { 1280 return DEFAULT_INSTANCE; 1281 } 1282 } 1283