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 * A request to annotate one single file, e.g. a PDF, TIFF or GIF file. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.vision.v1.AnnotateFileRequest} 29 */ 30 public final class AnnotateFileRequest extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.vision.v1.AnnotateFileRequest) 33 AnnotateFileRequestOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use AnnotateFileRequest.newBuilder() to construct. AnnotateFileRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private AnnotateFileRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 AnnotateFileRequest()40 private AnnotateFileRequest() { 41 features_ = java.util.Collections.emptyList(); 42 pages_ = emptyIntList(); 43 } 44 45 @java.lang.Override 46 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)47 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 48 return new AnnotateFileRequest(); 49 } 50 51 @java.lang.Override getUnknownFields()52 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 53 return this.unknownFields; 54 } 55 getDescriptor()56 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 57 return com.google.cloud.vision.v1.ImageAnnotatorProto 58 .internal_static_google_cloud_vision_v1_AnnotateFileRequest_descriptor; 59 } 60 61 @java.lang.Override 62 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()63 internalGetFieldAccessorTable() { 64 return com.google.cloud.vision.v1.ImageAnnotatorProto 65 .internal_static_google_cloud_vision_v1_AnnotateFileRequest_fieldAccessorTable 66 .ensureFieldAccessorsInitialized( 67 com.google.cloud.vision.v1.AnnotateFileRequest.class, 68 com.google.cloud.vision.v1.AnnotateFileRequest.Builder.class); 69 } 70 71 public static final int INPUT_CONFIG_FIELD_NUMBER = 1; 72 private com.google.cloud.vision.v1.InputConfig inputConfig_; 73 /** 74 * 75 * 76 * <pre> 77 * Required. Information about the input file. 78 * </pre> 79 * 80 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 81 * 82 * @return Whether the inputConfig field is set. 83 */ 84 @java.lang.Override hasInputConfig()85 public boolean hasInputConfig() { 86 return inputConfig_ != null; 87 } 88 /** 89 * 90 * 91 * <pre> 92 * Required. Information about the input file. 93 * </pre> 94 * 95 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 96 * 97 * @return The inputConfig. 98 */ 99 @java.lang.Override getInputConfig()100 public com.google.cloud.vision.v1.InputConfig getInputConfig() { 101 return inputConfig_ == null 102 ? com.google.cloud.vision.v1.InputConfig.getDefaultInstance() 103 : inputConfig_; 104 } 105 /** 106 * 107 * 108 * <pre> 109 * Required. Information about the input file. 110 * </pre> 111 * 112 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 113 */ 114 @java.lang.Override getInputConfigOrBuilder()115 public com.google.cloud.vision.v1.InputConfigOrBuilder getInputConfigOrBuilder() { 116 return inputConfig_ == null 117 ? com.google.cloud.vision.v1.InputConfig.getDefaultInstance() 118 : inputConfig_; 119 } 120 121 public static final int FEATURES_FIELD_NUMBER = 2; 122 123 @SuppressWarnings("serial") 124 private java.util.List<com.google.cloud.vision.v1.Feature> features_; 125 /** 126 * 127 * 128 * <pre> 129 * Required. Requested features. 130 * </pre> 131 * 132 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 133 */ 134 @java.lang.Override getFeaturesList()135 public java.util.List<com.google.cloud.vision.v1.Feature> getFeaturesList() { 136 return features_; 137 } 138 /** 139 * 140 * 141 * <pre> 142 * Required. Requested features. 143 * </pre> 144 * 145 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 146 */ 147 @java.lang.Override 148 public java.util.List<? extends com.google.cloud.vision.v1.FeatureOrBuilder> getFeaturesOrBuilderList()149 getFeaturesOrBuilderList() { 150 return features_; 151 } 152 /** 153 * 154 * 155 * <pre> 156 * Required. Requested features. 157 * </pre> 158 * 159 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 160 */ 161 @java.lang.Override getFeaturesCount()162 public int getFeaturesCount() { 163 return features_.size(); 164 } 165 /** 166 * 167 * 168 * <pre> 169 * Required. Requested features. 170 * </pre> 171 * 172 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 173 */ 174 @java.lang.Override getFeatures(int index)175 public com.google.cloud.vision.v1.Feature getFeatures(int index) { 176 return features_.get(index); 177 } 178 /** 179 * 180 * 181 * <pre> 182 * Required. Requested features. 183 * </pre> 184 * 185 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 186 */ 187 @java.lang.Override getFeaturesOrBuilder(int index)188 public com.google.cloud.vision.v1.FeatureOrBuilder getFeaturesOrBuilder(int index) { 189 return features_.get(index); 190 } 191 192 public static final int IMAGE_CONTEXT_FIELD_NUMBER = 3; 193 private com.google.cloud.vision.v1.ImageContext imageContext_; 194 /** 195 * 196 * 197 * <pre> 198 * Additional context that may accompany the image(s) in the file. 199 * </pre> 200 * 201 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 202 * 203 * @return Whether the imageContext field is set. 204 */ 205 @java.lang.Override hasImageContext()206 public boolean hasImageContext() { 207 return imageContext_ != null; 208 } 209 /** 210 * 211 * 212 * <pre> 213 * Additional context that may accompany the image(s) in the file. 214 * </pre> 215 * 216 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 217 * 218 * @return The imageContext. 219 */ 220 @java.lang.Override getImageContext()221 public com.google.cloud.vision.v1.ImageContext getImageContext() { 222 return imageContext_ == null 223 ? com.google.cloud.vision.v1.ImageContext.getDefaultInstance() 224 : imageContext_; 225 } 226 /** 227 * 228 * 229 * <pre> 230 * Additional context that may accompany the image(s) in the file. 231 * </pre> 232 * 233 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 234 */ 235 @java.lang.Override getImageContextOrBuilder()236 public com.google.cloud.vision.v1.ImageContextOrBuilder getImageContextOrBuilder() { 237 return imageContext_ == null 238 ? com.google.cloud.vision.v1.ImageContext.getDefaultInstance() 239 : imageContext_; 240 } 241 242 public static final int PAGES_FIELD_NUMBER = 4; 243 244 @SuppressWarnings("serial") 245 private com.google.protobuf.Internal.IntList pages_; 246 /** 247 * 248 * 249 * <pre> 250 * Pages of the file to perform image annotation. 251 * Pages starts from 1, we assume the first page of the file is page 1. 252 * At most 5 pages are supported per request. Pages can be negative. 253 * Page 1 means the first page. 254 * Page 2 means the second page. 255 * Page -1 means the last page. 256 * Page -2 means the second to the last page. 257 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 258 * If this field is empty, by default the service performs image annotation 259 * for the first 5 pages of the file. 260 * </pre> 261 * 262 * <code>repeated int32 pages = 4;</code> 263 * 264 * @return A list containing the pages. 265 */ 266 @java.lang.Override getPagesList()267 public java.util.List<java.lang.Integer> getPagesList() { 268 return pages_; 269 } 270 /** 271 * 272 * 273 * <pre> 274 * Pages of the file to perform image annotation. 275 * Pages starts from 1, we assume the first page of the file is page 1. 276 * At most 5 pages are supported per request. Pages can be negative. 277 * Page 1 means the first page. 278 * Page 2 means the second page. 279 * Page -1 means the last page. 280 * Page -2 means the second to the last page. 281 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 282 * If this field is empty, by default the service performs image annotation 283 * for the first 5 pages of the file. 284 * </pre> 285 * 286 * <code>repeated int32 pages = 4;</code> 287 * 288 * @return The count of pages. 289 */ getPagesCount()290 public int getPagesCount() { 291 return pages_.size(); 292 } 293 /** 294 * 295 * 296 * <pre> 297 * Pages of the file to perform image annotation. 298 * Pages starts from 1, we assume the first page of the file is page 1. 299 * At most 5 pages are supported per request. Pages can be negative. 300 * Page 1 means the first page. 301 * Page 2 means the second page. 302 * Page -1 means the last page. 303 * Page -2 means the second to the last page. 304 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 305 * If this field is empty, by default the service performs image annotation 306 * for the first 5 pages of the file. 307 * </pre> 308 * 309 * <code>repeated int32 pages = 4;</code> 310 * 311 * @param index The index of the element to return. 312 * @return The pages at the given index. 313 */ getPages(int index)314 public int getPages(int index) { 315 return pages_.getInt(index); 316 } 317 318 private int pagesMemoizedSerializedSize = -1; 319 320 private byte memoizedIsInitialized = -1; 321 322 @java.lang.Override isInitialized()323 public final boolean isInitialized() { 324 byte isInitialized = memoizedIsInitialized; 325 if (isInitialized == 1) return true; 326 if (isInitialized == 0) return false; 327 328 memoizedIsInitialized = 1; 329 return true; 330 } 331 332 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)333 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 334 getSerializedSize(); 335 if (inputConfig_ != null) { 336 output.writeMessage(1, getInputConfig()); 337 } 338 for (int i = 0; i < features_.size(); i++) { 339 output.writeMessage(2, features_.get(i)); 340 } 341 if (imageContext_ != null) { 342 output.writeMessage(3, getImageContext()); 343 } 344 if (getPagesList().size() > 0) { 345 output.writeUInt32NoTag(34); 346 output.writeUInt32NoTag(pagesMemoizedSerializedSize); 347 } 348 for (int i = 0; i < pages_.size(); i++) { 349 output.writeInt32NoTag(pages_.getInt(i)); 350 } 351 getUnknownFields().writeTo(output); 352 } 353 354 @java.lang.Override getSerializedSize()355 public int getSerializedSize() { 356 int size = memoizedSize; 357 if (size != -1) return size; 358 359 size = 0; 360 if (inputConfig_ != null) { 361 size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getInputConfig()); 362 } 363 for (int i = 0; i < features_.size(); i++) { 364 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, features_.get(i)); 365 } 366 if (imageContext_ != null) { 367 size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getImageContext()); 368 } 369 { 370 int dataSize = 0; 371 for (int i = 0; i < pages_.size(); i++) { 372 dataSize += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(pages_.getInt(i)); 373 } 374 size += dataSize; 375 if (!getPagesList().isEmpty()) { 376 size += 1; 377 size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); 378 } 379 pagesMemoizedSerializedSize = dataSize; 380 } 381 size += getUnknownFields().getSerializedSize(); 382 memoizedSize = size; 383 return size; 384 } 385 386 @java.lang.Override equals(final java.lang.Object obj)387 public boolean equals(final java.lang.Object obj) { 388 if (obj == this) { 389 return true; 390 } 391 if (!(obj instanceof com.google.cloud.vision.v1.AnnotateFileRequest)) { 392 return super.equals(obj); 393 } 394 com.google.cloud.vision.v1.AnnotateFileRequest other = 395 (com.google.cloud.vision.v1.AnnotateFileRequest) obj; 396 397 if (hasInputConfig() != other.hasInputConfig()) return false; 398 if (hasInputConfig()) { 399 if (!getInputConfig().equals(other.getInputConfig())) return false; 400 } 401 if (!getFeaturesList().equals(other.getFeaturesList())) return false; 402 if (hasImageContext() != other.hasImageContext()) return false; 403 if (hasImageContext()) { 404 if (!getImageContext().equals(other.getImageContext())) return false; 405 } 406 if (!getPagesList().equals(other.getPagesList())) return false; 407 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 408 return true; 409 } 410 411 @java.lang.Override hashCode()412 public int hashCode() { 413 if (memoizedHashCode != 0) { 414 return memoizedHashCode; 415 } 416 int hash = 41; 417 hash = (19 * hash) + getDescriptor().hashCode(); 418 if (hasInputConfig()) { 419 hash = (37 * hash) + INPUT_CONFIG_FIELD_NUMBER; 420 hash = (53 * hash) + getInputConfig().hashCode(); 421 } 422 if (getFeaturesCount() > 0) { 423 hash = (37 * hash) + FEATURES_FIELD_NUMBER; 424 hash = (53 * hash) + getFeaturesList().hashCode(); 425 } 426 if (hasImageContext()) { 427 hash = (37 * hash) + IMAGE_CONTEXT_FIELD_NUMBER; 428 hash = (53 * hash) + getImageContext().hashCode(); 429 } 430 if (getPagesCount() > 0) { 431 hash = (37 * hash) + PAGES_FIELD_NUMBER; 432 hash = (53 * hash) + getPagesList().hashCode(); 433 } 434 hash = (29 * hash) + getUnknownFields().hashCode(); 435 memoizedHashCode = hash; 436 return hash; 437 } 438 parseFrom(java.nio.ByteBuffer data)439 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom(java.nio.ByteBuffer data) 440 throws com.google.protobuf.InvalidProtocolBufferException { 441 return PARSER.parseFrom(data); 442 } 443 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)444 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom( 445 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 446 throws com.google.protobuf.InvalidProtocolBufferException { 447 return PARSER.parseFrom(data, extensionRegistry); 448 } 449 parseFrom( com.google.protobuf.ByteString data)450 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom( 451 com.google.protobuf.ByteString data) 452 throws com.google.protobuf.InvalidProtocolBufferException { 453 return PARSER.parseFrom(data); 454 } 455 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)456 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom( 457 com.google.protobuf.ByteString data, 458 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 459 throws com.google.protobuf.InvalidProtocolBufferException { 460 return PARSER.parseFrom(data, extensionRegistry); 461 } 462 parseFrom(byte[] data)463 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom(byte[] data) 464 throws com.google.protobuf.InvalidProtocolBufferException { 465 return PARSER.parseFrom(data); 466 } 467 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)468 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom( 469 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 470 throws com.google.protobuf.InvalidProtocolBufferException { 471 return PARSER.parseFrom(data, extensionRegistry); 472 } 473 parseFrom(java.io.InputStream input)474 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom(java.io.InputStream input) 475 throws java.io.IOException { 476 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 477 } 478 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)479 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom( 480 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 481 throws java.io.IOException { 482 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 483 PARSER, input, extensionRegistry); 484 } 485 parseDelimitedFrom( java.io.InputStream input)486 public static com.google.cloud.vision.v1.AnnotateFileRequest parseDelimitedFrom( 487 java.io.InputStream input) throws java.io.IOException { 488 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 489 } 490 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)491 public static com.google.cloud.vision.v1.AnnotateFileRequest parseDelimitedFrom( 492 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 493 throws java.io.IOException { 494 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 495 PARSER, input, extensionRegistry); 496 } 497 parseFrom( com.google.protobuf.CodedInputStream input)498 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom( 499 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 500 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 501 } 502 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)503 public static com.google.cloud.vision.v1.AnnotateFileRequest parseFrom( 504 com.google.protobuf.CodedInputStream input, 505 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 506 throws java.io.IOException { 507 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 508 PARSER, input, extensionRegistry); 509 } 510 511 @java.lang.Override newBuilderForType()512 public Builder newBuilderForType() { 513 return newBuilder(); 514 } 515 newBuilder()516 public static Builder newBuilder() { 517 return DEFAULT_INSTANCE.toBuilder(); 518 } 519 newBuilder(com.google.cloud.vision.v1.AnnotateFileRequest prototype)520 public static Builder newBuilder(com.google.cloud.vision.v1.AnnotateFileRequest prototype) { 521 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 522 } 523 524 @java.lang.Override toBuilder()525 public Builder toBuilder() { 526 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 527 } 528 529 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)530 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 531 Builder builder = new Builder(parent); 532 return builder; 533 } 534 /** 535 * 536 * 537 * <pre> 538 * A request to annotate one single file, e.g. a PDF, TIFF or GIF file. 539 * </pre> 540 * 541 * Protobuf type {@code google.cloud.vision.v1.AnnotateFileRequest} 542 */ 543 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 544 implements 545 // @@protoc_insertion_point(builder_implements:google.cloud.vision.v1.AnnotateFileRequest) 546 com.google.cloud.vision.v1.AnnotateFileRequestOrBuilder { getDescriptor()547 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 548 return com.google.cloud.vision.v1.ImageAnnotatorProto 549 .internal_static_google_cloud_vision_v1_AnnotateFileRequest_descriptor; 550 } 551 552 @java.lang.Override 553 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()554 internalGetFieldAccessorTable() { 555 return com.google.cloud.vision.v1.ImageAnnotatorProto 556 .internal_static_google_cloud_vision_v1_AnnotateFileRequest_fieldAccessorTable 557 .ensureFieldAccessorsInitialized( 558 com.google.cloud.vision.v1.AnnotateFileRequest.class, 559 com.google.cloud.vision.v1.AnnotateFileRequest.Builder.class); 560 } 561 562 // Construct using com.google.cloud.vision.v1.AnnotateFileRequest.newBuilder() Builder()563 private Builder() {} 564 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)565 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 566 super(parent); 567 } 568 569 @java.lang.Override clear()570 public Builder clear() { 571 super.clear(); 572 bitField0_ = 0; 573 inputConfig_ = null; 574 if (inputConfigBuilder_ != null) { 575 inputConfigBuilder_.dispose(); 576 inputConfigBuilder_ = null; 577 } 578 if (featuresBuilder_ == null) { 579 features_ = java.util.Collections.emptyList(); 580 } else { 581 features_ = null; 582 featuresBuilder_.clear(); 583 } 584 bitField0_ = (bitField0_ & ~0x00000002); 585 imageContext_ = null; 586 if (imageContextBuilder_ != null) { 587 imageContextBuilder_.dispose(); 588 imageContextBuilder_ = null; 589 } 590 pages_ = emptyIntList(); 591 return this; 592 } 593 594 @java.lang.Override getDescriptorForType()595 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 596 return com.google.cloud.vision.v1.ImageAnnotatorProto 597 .internal_static_google_cloud_vision_v1_AnnotateFileRequest_descriptor; 598 } 599 600 @java.lang.Override getDefaultInstanceForType()601 public com.google.cloud.vision.v1.AnnotateFileRequest getDefaultInstanceForType() { 602 return com.google.cloud.vision.v1.AnnotateFileRequest.getDefaultInstance(); 603 } 604 605 @java.lang.Override build()606 public com.google.cloud.vision.v1.AnnotateFileRequest build() { 607 com.google.cloud.vision.v1.AnnotateFileRequest result = buildPartial(); 608 if (!result.isInitialized()) { 609 throw newUninitializedMessageException(result); 610 } 611 return result; 612 } 613 614 @java.lang.Override buildPartial()615 public com.google.cloud.vision.v1.AnnotateFileRequest buildPartial() { 616 com.google.cloud.vision.v1.AnnotateFileRequest result = 617 new com.google.cloud.vision.v1.AnnotateFileRequest(this); 618 buildPartialRepeatedFields(result); 619 if (bitField0_ != 0) { 620 buildPartial0(result); 621 } 622 onBuilt(); 623 return result; 624 } 625 buildPartialRepeatedFields(com.google.cloud.vision.v1.AnnotateFileRequest result)626 private void buildPartialRepeatedFields(com.google.cloud.vision.v1.AnnotateFileRequest result) { 627 if (featuresBuilder_ == null) { 628 if (((bitField0_ & 0x00000002) != 0)) { 629 features_ = java.util.Collections.unmodifiableList(features_); 630 bitField0_ = (bitField0_ & ~0x00000002); 631 } 632 result.features_ = features_; 633 } else { 634 result.features_ = featuresBuilder_.build(); 635 } 636 if (((bitField0_ & 0x00000008) != 0)) { 637 pages_.makeImmutable(); 638 bitField0_ = (bitField0_ & ~0x00000008); 639 } 640 result.pages_ = pages_; 641 } 642 buildPartial0(com.google.cloud.vision.v1.AnnotateFileRequest result)643 private void buildPartial0(com.google.cloud.vision.v1.AnnotateFileRequest result) { 644 int from_bitField0_ = bitField0_; 645 if (((from_bitField0_ & 0x00000001) != 0)) { 646 result.inputConfig_ = 647 inputConfigBuilder_ == null ? inputConfig_ : inputConfigBuilder_.build(); 648 } 649 if (((from_bitField0_ & 0x00000004) != 0)) { 650 result.imageContext_ = 651 imageContextBuilder_ == null ? imageContext_ : imageContextBuilder_.build(); 652 } 653 } 654 655 @java.lang.Override clone()656 public Builder clone() { 657 return super.clone(); 658 } 659 660 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)661 public Builder setField( 662 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 663 return super.setField(field, value); 664 } 665 666 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)667 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 668 return super.clearField(field); 669 } 670 671 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)672 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 673 return super.clearOneof(oneof); 674 } 675 676 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)677 public Builder setRepeatedField( 678 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 679 return super.setRepeatedField(field, index, value); 680 } 681 682 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)683 public Builder addRepeatedField( 684 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 685 return super.addRepeatedField(field, value); 686 } 687 688 @java.lang.Override mergeFrom(com.google.protobuf.Message other)689 public Builder mergeFrom(com.google.protobuf.Message other) { 690 if (other instanceof com.google.cloud.vision.v1.AnnotateFileRequest) { 691 return mergeFrom((com.google.cloud.vision.v1.AnnotateFileRequest) other); 692 } else { 693 super.mergeFrom(other); 694 return this; 695 } 696 } 697 mergeFrom(com.google.cloud.vision.v1.AnnotateFileRequest other)698 public Builder mergeFrom(com.google.cloud.vision.v1.AnnotateFileRequest other) { 699 if (other == com.google.cloud.vision.v1.AnnotateFileRequest.getDefaultInstance()) return this; 700 if (other.hasInputConfig()) { 701 mergeInputConfig(other.getInputConfig()); 702 } 703 if (featuresBuilder_ == null) { 704 if (!other.features_.isEmpty()) { 705 if (features_.isEmpty()) { 706 features_ = other.features_; 707 bitField0_ = (bitField0_ & ~0x00000002); 708 } else { 709 ensureFeaturesIsMutable(); 710 features_.addAll(other.features_); 711 } 712 onChanged(); 713 } 714 } else { 715 if (!other.features_.isEmpty()) { 716 if (featuresBuilder_.isEmpty()) { 717 featuresBuilder_.dispose(); 718 featuresBuilder_ = null; 719 features_ = other.features_; 720 bitField0_ = (bitField0_ & ~0x00000002); 721 featuresBuilder_ = 722 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 723 ? getFeaturesFieldBuilder() 724 : null; 725 } else { 726 featuresBuilder_.addAllMessages(other.features_); 727 } 728 } 729 } 730 if (other.hasImageContext()) { 731 mergeImageContext(other.getImageContext()); 732 } 733 if (!other.pages_.isEmpty()) { 734 if (pages_.isEmpty()) { 735 pages_ = other.pages_; 736 bitField0_ = (bitField0_ & ~0x00000008); 737 } else { 738 ensurePagesIsMutable(); 739 pages_.addAll(other.pages_); 740 } 741 onChanged(); 742 } 743 this.mergeUnknownFields(other.getUnknownFields()); 744 onChanged(); 745 return this; 746 } 747 748 @java.lang.Override isInitialized()749 public final boolean isInitialized() { 750 return true; 751 } 752 753 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)754 public Builder mergeFrom( 755 com.google.protobuf.CodedInputStream input, 756 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 757 throws java.io.IOException { 758 if (extensionRegistry == null) { 759 throw new java.lang.NullPointerException(); 760 } 761 try { 762 boolean done = false; 763 while (!done) { 764 int tag = input.readTag(); 765 switch (tag) { 766 case 0: 767 done = true; 768 break; 769 case 10: 770 { 771 input.readMessage(getInputConfigFieldBuilder().getBuilder(), extensionRegistry); 772 bitField0_ |= 0x00000001; 773 break; 774 } // case 10 775 case 18: 776 { 777 com.google.cloud.vision.v1.Feature m = 778 input.readMessage( 779 com.google.cloud.vision.v1.Feature.parser(), extensionRegistry); 780 if (featuresBuilder_ == null) { 781 ensureFeaturesIsMutable(); 782 features_.add(m); 783 } else { 784 featuresBuilder_.addMessage(m); 785 } 786 break; 787 } // case 18 788 case 26: 789 { 790 input.readMessage(getImageContextFieldBuilder().getBuilder(), extensionRegistry); 791 bitField0_ |= 0x00000004; 792 break; 793 } // case 26 794 case 32: 795 { 796 int v = input.readInt32(); 797 ensurePagesIsMutable(); 798 pages_.addInt(v); 799 break; 800 } // case 32 801 case 34: 802 { 803 int length = input.readRawVarint32(); 804 int limit = input.pushLimit(length); 805 ensurePagesIsMutable(); 806 while (input.getBytesUntilLimit() > 0) { 807 pages_.addInt(input.readInt32()); 808 } 809 input.popLimit(limit); 810 break; 811 } // case 34 812 default: 813 { 814 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 815 done = true; // was an endgroup tag 816 } 817 break; 818 } // default: 819 } // switch (tag) 820 } // while (!done) 821 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 822 throw e.unwrapIOException(); 823 } finally { 824 onChanged(); 825 } // finally 826 return this; 827 } 828 829 private int bitField0_; 830 831 private com.google.cloud.vision.v1.InputConfig inputConfig_; 832 private com.google.protobuf.SingleFieldBuilderV3< 833 com.google.cloud.vision.v1.InputConfig, 834 com.google.cloud.vision.v1.InputConfig.Builder, 835 com.google.cloud.vision.v1.InputConfigOrBuilder> 836 inputConfigBuilder_; 837 /** 838 * 839 * 840 * <pre> 841 * Required. Information about the input file. 842 * </pre> 843 * 844 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 845 * 846 * @return Whether the inputConfig field is set. 847 */ hasInputConfig()848 public boolean hasInputConfig() { 849 return ((bitField0_ & 0x00000001) != 0); 850 } 851 /** 852 * 853 * 854 * <pre> 855 * Required. Information about the input file. 856 * </pre> 857 * 858 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 859 * 860 * @return The inputConfig. 861 */ getInputConfig()862 public com.google.cloud.vision.v1.InputConfig getInputConfig() { 863 if (inputConfigBuilder_ == null) { 864 return inputConfig_ == null 865 ? com.google.cloud.vision.v1.InputConfig.getDefaultInstance() 866 : inputConfig_; 867 } else { 868 return inputConfigBuilder_.getMessage(); 869 } 870 } 871 /** 872 * 873 * 874 * <pre> 875 * Required. Information about the input file. 876 * </pre> 877 * 878 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 879 */ setInputConfig(com.google.cloud.vision.v1.InputConfig value)880 public Builder setInputConfig(com.google.cloud.vision.v1.InputConfig value) { 881 if (inputConfigBuilder_ == null) { 882 if (value == null) { 883 throw new NullPointerException(); 884 } 885 inputConfig_ = value; 886 } else { 887 inputConfigBuilder_.setMessage(value); 888 } 889 bitField0_ |= 0x00000001; 890 onChanged(); 891 return this; 892 } 893 /** 894 * 895 * 896 * <pre> 897 * Required. Information about the input file. 898 * </pre> 899 * 900 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 901 */ setInputConfig(com.google.cloud.vision.v1.InputConfig.Builder builderForValue)902 public Builder setInputConfig(com.google.cloud.vision.v1.InputConfig.Builder builderForValue) { 903 if (inputConfigBuilder_ == null) { 904 inputConfig_ = builderForValue.build(); 905 } else { 906 inputConfigBuilder_.setMessage(builderForValue.build()); 907 } 908 bitField0_ |= 0x00000001; 909 onChanged(); 910 return this; 911 } 912 /** 913 * 914 * 915 * <pre> 916 * Required. Information about the input file. 917 * </pre> 918 * 919 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 920 */ mergeInputConfig(com.google.cloud.vision.v1.InputConfig value)921 public Builder mergeInputConfig(com.google.cloud.vision.v1.InputConfig value) { 922 if (inputConfigBuilder_ == null) { 923 if (((bitField0_ & 0x00000001) != 0) 924 && inputConfig_ != null 925 && inputConfig_ != com.google.cloud.vision.v1.InputConfig.getDefaultInstance()) { 926 getInputConfigBuilder().mergeFrom(value); 927 } else { 928 inputConfig_ = value; 929 } 930 } else { 931 inputConfigBuilder_.mergeFrom(value); 932 } 933 bitField0_ |= 0x00000001; 934 onChanged(); 935 return this; 936 } 937 /** 938 * 939 * 940 * <pre> 941 * Required. Information about the input file. 942 * </pre> 943 * 944 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 945 */ clearInputConfig()946 public Builder clearInputConfig() { 947 bitField0_ = (bitField0_ & ~0x00000001); 948 inputConfig_ = null; 949 if (inputConfigBuilder_ != null) { 950 inputConfigBuilder_.dispose(); 951 inputConfigBuilder_ = null; 952 } 953 onChanged(); 954 return this; 955 } 956 /** 957 * 958 * 959 * <pre> 960 * Required. Information about the input file. 961 * </pre> 962 * 963 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 964 */ getInputConfigBuilder()965 public com.google.cloud.vision.v1.InputConfig.Builder getInputConfigBuilder() { 966 bitField0_ |= 0x00000001; 967 onChanged(); 968 return getInputConfigFieldBuilder().getBuilder(); 969 } 970 /** 971 * 972 * 973 * <pre> 974 * Required. Information about the input file. 975 * </pre> 976 * 977 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 978 */ getInputConfigOrBuilder()979 public com.google.cloud.vision.v1.InputConfigOrBuilder getInputConfigOrBuilder() { 980 if (inputConfigBuilder_ != null) { 981 return inputConfigBuilder_.getMessageOrBuilder(); 982 } else { 983 return inputConfig_ == null 984 ? com.google.cloud.vision.v1.InputConfig.getDefaultInstance() 985 : inputConfig_; 986 } 987 } 988 /** 989 * 990 * 991 * <pre> 992 * Required. Information about the input file. 993 * </pre> 994 * 995 * <code>.google.cloud.vision.v1.InputConfig input_config = 1;</code> 996 */ 997 private com.google.protobuf.SingleFieldBuilderV3< 998 com.google.cloud.vision.v1.InputConfig, 999 com.google.cloud.vision.v1.InputConfig.Builder, 1000 com.google.cloud.vision.v1.InputConfigOrBuilder> getInputConfigFieldBuilder()1001 getInputConfigFieldBuilder() { 1002 if (inputConfigBuilder_ == null) { 1003 inputConfigBuilder_ = 1004 new com.google.protobuf.SingleFieldBuilderV3< 1005 com.google.cloud.vision.v1.InputConfig, 1006 com.google.cloud.vision.v1.InputConfig.Builder, 1007 com.google.cloud.vision.v1.InputConfigOrBuilder>( 1008 getInputConfig(), getParentForChildren(), isClean()); 1009 inputConfig_ = null; 1010 } 1011 return inputConfigBuilder_; 1012 } 1013 1014 private java.util.List<com.google.cloud.vision.v1.Feature> features_ = 1015 java.util.Collections.emptyList(); 1016 ensureFeaturesIsMutable()1017 private void ensureFeaturesIsMutable() { 1018 if (!((bitField0_ & 0x00000002) != 0)) { 1019 features_ = new java.util.ArrayList<com.google.cloud.vision.v1.Feature>(features_); 1020 bitField0_ |= 0x00000002; 1021 } 1022 } 1023 1024 private com.google.protobuf.RepeatedFieldBuilderV3< 1025 com.google.cloud.vision.v1.Feature, 1026 com.google.cloud.vision.v1.Feature.Builder, 1027 com.google.cloud.vision.v1.FeatureOrBuilder> 1028 featuresBuilder_; 1029 1030 /** 1031 * 1032 * 1033 * <pre> 1034 * Required. Requested features. 1035 * </pre> 1036 * 1037 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1038 */ getFeaturesList()1039 public java.util.List<com.google.cloud.vision.v1.Feature> getFeaturesList() { 1040 if (featuresBuilder_ == null) { 1041 return java.util.Collections.unmodifiableList(features_); 1042 } else { 1043 return featuresBuilder_.getMessageList(); 1044 } 1045 } 1046 /** 1047 * 1048 * 1049 * <pre> 1050 * Required. Requested features. 1051 * </pre> 1052 * 1053 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1054 */ getFeaturesCount()1055 public int getFeaturesCount() { 1056 if (featuresBuilder_ == null) { 1057 return features_.size(); 1058 } else { 1059 return featuresBuilder_.getCount(); 1060 } 1061 } 1062 /** 1063 * 1064 * 1065 * <pre> 1066 * Required. Requested features. 1067 * </pre> 1068 * 1069 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1070 */ getFeatures(int index)1071 public com.google.cloud.vision.v1.Feature getFeatures(int index) { 1072 if (featuresBuilder_ == null) { 1073 return features_.get(index); 1074 } else { 1075 return featuresBuilder_.getMessage(index); 1076 } 1077 } 1078 /** 1079 * 1080 * 1081 * <pre> 1082 * Required. Requested features. 1083 * </pre> 1084 * 1085 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1086 */ setFeatures(int index, com.google.cloud.vision.v1.Feature value)1087 public Builder setFeatures(int index, com.google.cloud.vision.v1.Feature value) { 1088 if (featuresBuilder_ == null) { 1089 if (value == null) { 1090 throw new NullPointerException(); 1091 } 1092 ensureFeaturesIsMutable(); 1093 features_.set(index, value); 1094 onChanged(); 1095 } else { 1096 featuresBuilder_.setMessage(index, value); 1097 } 1098 return this; 1099 } 1100 /** 1101 * 1102 * 1103 * <pre> 1104 * Required. Requested features. 1105 * </pre> 1106 * 1107 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1108 */ setFeatures( int index, com.google.cloud.vision.v1.Feature.Builder builderForValue)1109 public Builder setFeatures( 1110 int index, com.google.cloud.vision.v1.Feature.Builder builderForValue) { 1111 if (featuresBuilder_ == null) { 1112 ensureFeaturesIsMutable(); 1113 features_.set(index, builderForValue.build()); 1114 onChanged(); 1115 } else { 1116 featuresBuilder_.setMessage(index, builderForValue.build()); 1117 } 1118 return this; 1119 } 1120 /** 1121 * 1122 * 1123 * <pre> 1124 * Required. Requested features. 1125 * </pre> 1126 * 1127 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1128 */ addFeatures(com.google.cloud.vision.v1.Feature value)1129 public Builder addFeatures(com.google.cloud.vision.v1.Feature value) { 1130 if (featuresBuilder_ == null) { 1131 if (value == null) { 1132 throw new NullPointerException(); 1133 } 1134 ensureFeaturesIsMutable(); 1135 features_.add(value); 1136 onChanged(); 1137 } else { 1138 featuresBuilder_.addMessage(value); 1139 } 1140 return this; 1141 } 1142 /** 1143 * 1144 * 1145 * <pre> 1146 * Required. Requested features. 1147 * </pre> 1148 * 1149 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1150 */ addFeatures(int index, com.google.cloud.vision.v1.Feature value)1151 public Builder addFeatures(int index, com.google.cloud.vision.v1.Feature value) { 1152 if (featuresBuilder_ == null) { 1153 if (value == null) { 1154 throw new NullPointerException(); 1155 } 1156 ensureFeaturesIsMutable(); 1157 features_.add(index, value); 1158 onChanged(); 1159 } else { 1160 featuresBuilder_.addMessage(index, value); 1161 } 1162 return this; 1163 } 1164 /** 1165 * 1166 * 1167 * <pre> 1168 * Required. Requested features. 1169 * </pre> 1170 * 1171 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1172 */ addFeatures(com.google.cloud.vision.v1.Feature.Builder builderForValue)1173 public Builder addFeatures(com.google.cloud.vision.v1.Feature.Builder builderForValue) { 1174 if (featuresBuilder_ == null) { 1175 ensureFeaturesIsMutable(); 1176 features_.add(builderForValue.build()); 1177 onChanged(); 1178 } else { 1179 featuresBuilder_.addMessage(builderForValue.build()); 1180 } 1181 return this; 1182 } 1183 /** 1184 * 1185 * 1186 * <pre> 1187 * Required. Requested features. 1188 * </pre> 1189 * 1190 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1191 */ addFeatures( int index, com.google.cloud.vision.v1.Feature.Builder builderForValue)1192 public Builder addFeatures( 1193 int index, com.google.cloud.vision.v1.Feature.Builder builderForValue) { 1194 if (featuresBuilder_ == null) { 1195 ensureFeaturesIsMutable(); 1196 features_.add(index, builderForValue.build()); 1197 onChanged(); 1198 } else { 1199 featuresBuilder_.addMessage(index, builderForValue.build()); 1200 } 1201 return this; 1202 } 1203 /** 1204 * 1205 * 1206 * <pre> 1207 * Required. Requested features. 1208 * </pre> 1209 * 1210 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1211 */ addAllFeatures( java.lang.Iterable<? extends com.google.cloud.vision.v1.Feature> values)1212 public Builder addAllFeatures( 1213 java.lang.Iterable<? extends com.google.cloud.vision.v1.Feature> values) { 1214 if (featuresBuilder_ == null) { 1215 ensureFeaturesIsMutable(); 1216 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, features_); 1217 onChanged(); 1218 } else { 1219 featuresBuilder_.addAllMessages(values); 1220 } 1221 return this; 1222 } 1223 /** 1224 * 1225 * 1226 * <pre> 1227 * Required. Requested features. 1228 * </pre> 1229 * 1230 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1231 */ clearFeatures()1232 public Builder clearFeatures() { 1233 if (featuresBuilder_ == null) { 1234 features_ = java.util.Collections.emptyList(); 1235 bitField0_ = (bitField0_ & ~0x00000002); 1236 onChanged(); 1237 } else { 1238 featuresBuilder_.clear(); 1239 } 1240 return this; 1241 } 1242 /** 1243 * 1244 * 1245 * <pre> 1246 * Required. Requested features. 1247 * </pre> 1248 * 1249 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1250 */ removeFeatures(int index)1251 public Builder removeFeatures(int index) { 1252 if (featuresBuilder_ == null) { 1253 ensureFeaturesIsMutable(); 1254 features_.remove(index); 1255 onChanged(); 1256 } else { 1257 featuresBuilder_.remove(index); 1258 } 1259 return this; 1260 } 1261 /** 1262 * 1263 * 1264 * <pre> 1265 * Required. Requested features. 1266 * </pre> 1267 * 1268 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1269 */ getFeaturesBuilder(int index)1270 public com.google.cloud.vision.v1.Feature.Builder getFeaturesBuilder(int index) { 1271 return getFeaturesFieldBuilder().getBuilder(index); 1272 } 1273 /** 1274 * 1275 * 1276 * <pre> 1277 * Required. Requested features. 1278 * </pre> 1279 * 1280 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1281 */ getFeaturesOrBuilder(int index)1282 public com.google.cloud.vision.v1.FeatureOrBuilder getFeaturesOrBuilder(int index) { 1283 if (featuresBuilder_ == null) { 1284 return features_.get(index); 1285 } else { 1286 return featuresBuilder_.getMessageOrBuilder(index); 1287 } 1288 } 1289 /** 1290 * 1291 * 1292 * <pre> 1293 * Required. Requested features. 1294 * </pre> 1295 * 1296 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1297 */ 1298 public java.util.List<? extends com.google.cloud.vision.v1.FeatureOrBuilder> getFeaturesOrBuilderList()1299 getFeaturesOrBuilderList() { 1300 if (featuresBuilder_ != null) { 1301 return featuresBuilder_.getMessageOrBuilderList(); 1302 } else { 1303 return java.util.Collections.unmodifiableList(features_); 1304 } 1305 } 1306 /** 1307 * 1308 * 1309 * <pre> 1310 * Required. Requested features. 1311 * </pre> 1312 * 1313 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1314 */ addFeaturesBuilder()1315 public com.google.cloud.vision.v1.Feature.Builder addFeaturesBuilder() { 1316 return getFeaturesFieldBuilder() 1317 .addBuilder(com.google.cloud.vision.v1.Feature.getDefaultInstance()); 1318 } 1319 /** 1320 * 1321 * 1322 * <pre> 1323 * Required. Requested features. 1324 * </pre> 1325 * 1326 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1327 */ addFeaturesBuilder(int index)1328 public com.google.cloud.vision.v1.Feature.Builder addFeaturesBuilder(int index) { 1329 return getFeaturesFieldBuilder() 1330 .addBuilder(index, com.google.cloud.vision.v1.Feature.getDefaultInstance()); 1331 } 1332 /** 1333 * 1334 * 1335 * <pre> 1336 * Required. Requested features. 1337 * </pre> 1338 * 1339 * <code>repeated .google.cloud.vision.v1.Feature features = 2;</code> 1340 */ getFeaturesBuilderList()1341 public java.util.List<com.google.cloud.vision.v1.Feature.Builder> getFeaturesBuilderList() { 1342 return getFeaturesFieldBuilder().getBuilderList(); 1343 } 1344 1345 private com.google.protobuf.RepeatedFieldBuilderV3< 1346 com.google.cloud.vision.v1.Feature, 1347 com.google.cloud.vision.v1.Feature.Builder, 1348 com.google.cloud.vision.v1.FeatureOrBuilder> getFeaturesFieldBuilder()1349 getFeaturesFieldBuilder() { 1350 if (featuresBuilder_ == null) { 1351 featuresBuilder_ = 1352 new com.google.protobuf.RepeatedFieldBuilderV3< 1353 com.google.cloud.vision.v1.Feature, 1354 com.google.cloud.vision.v1.Feature.Builder, 1355 com.google.cloud.vision.v1.FeatureOrBuilder>( 1356 features_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); 1357 features_ = null; 1358 } 1359 return featuresBuilder_; 1360 } 1361 1362 private com.google.cloud.vision.v1.ImageContext imageContext_; 1363 private com.google.protobuf.SingleFieldBuilderV3< 1364 com.google.cloud.vision.v1.ImageContext, 1365 com.google.cloud.vision.v1.ImageContext.Builder, 1366 com.google.cloud.vision.v1.ImageContextOrBuilder> 1367 imageContextBuilder_; 1368 /** 1369 * 1370 * 1371 * <pre> 1372 * Additional context that may accompany the image(s) in the file. 1373 * </pre> 1374 * 1375 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1376 * 1377 * @return Whether the imageContext field is set. 1378 */ hasImageContext()1379 public boolean hasImageContext() { 1380 return ((bitField0_ & 0x00000004) != 0); 1381 } 1382 /** 1383 * 1384 * 1385 * <pre> 1386 * Additional context that may accompany the image(s) in the file. 1387 * </pre> 1388 * 1389 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1390 * 1391 * @return The imageContext. 1392 */ getImageContext()1393 public com.google.cloud.vision.v1.ImageContext getImageContext() { 1394 if (imageContextBuilder_ == null) { 1395 return imageContext_ == null 1396 ? com.google.cloud.vision.v1.ImageContext.getDefaultInstance() 1397 : imageContext_; 1398 } else { 1399 return imageContextBuilder_.getMessage(); 1400 } 1401 } 1402 /** 1403 * 1404 * 1405 * <pre> 1406 * Additional context that may accompany the image(s) in the file. 1407 * </pre> 1408 * 1409 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1410 */ setImageContext(com.google.cloud.vision.v1.ImageContext value)1411 public Builder setImageContext(com.google.cloud.vision.v1.ImageContext value) { 1412 if (imageContextBuilder_ == null) { 1413 if (value == null) { 1414 throw new NullPointerException(); 1415 } 1416 imageContext_ = value; 1417 } else { 1418 imageContextBuilder_.setMessage(value); 1419 } 1420 bitField0_ |= 0x00000004; 1421 onChanged(); 1422 return this; 1423 } 1424 /** 1425 * 1426 * 1427 * <pre> 1428 * Additional context that may accompany the image(s) in the file. 1429 * </pre> 1430 * 1431 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1432 */ setImageContext( com.google.cloud.vision.v1.ImageContext.Builder builderForValue)1433 public Builder setImageContext( 1434 com.google.cloud.vision.v1.ImageContext.Builder builderForValue) { 1435 if (imageContextBuilder_ == null) { 1436 imageContext_ = builderForValue.build(); 1437 } else { 1438 imageContextBuilder_.setMessage(builderForValue.build()); 1439 } 1440 bitField0_ |= 0x00000004; 1441 onChanged(); 1442 return this; 1443 } 1444 /** 1445 * 1446 * 1447 * <pre> 1448 * Additional context that may accompany the image(s) in the file. 1449 * </pre> 1450 * 1451 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1452 */ mergeImageContext(com.google.cloud.vision.v1.ImageContext value)1453 public Builder mergeImageContext(com.google.cloud.vision.v1.ImageContext value) { 1454 if (imageContextBuilder_ == null) { 1455 if (((bitField0_ & 0x00000004) != 0) 1456 && imageContext_ != null 1457 && imageContext_ != com.google.cloud.vision.v1.ImageContext.getDefaultInstance()) { 1458 getImageContextBuilder().mergeFrom(value); 1459 } else { 1460 imageContext_ = value; 1461 } 1462 } else { 1463 imageContextBuilder_.mergeFrom(value); 1464 } 1465 bitField0_ |= 0x00000004; 1466 onChanged(); 1467 return this; 1468 } 1469 /** 1470 * 1471 * 1472 * <pre> 1473 * Additional context that may accompany the image(s) in the file. 1474 * </pre> 1475 * 1476 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1477 */ clearImageContext()1478 public Builder clearImageContext() { 1479 bitField0_ = (bitField0_ & ~0x00000004); 1480 imageContext_ = null; 1481 if (imageContextBuilder_ != null) { 1482 imageContextBuilder_.dispose(); 1483 imageContextBuilder_ = null; 1484 } 1485 onChanged(); 1486 return this; 1487 } 1488 /** 1489 * 1490 * 1491 * <pre> 1492 * Additional context that may accompany the image(s) in the file. 1493 * </pre> 1494 * 1495 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1496 */ getImageContextBuilder()1497 public com.google.cloud.vision.v1.ImageContext.Builder getImageContextBuilder() { 1498 bitField0_ |= 0x00000004; 1499 onChanged(); 1500 return getImageContextFieldBuilder().getBuilder(); 1501 } 1502 /** 1503 * 1504 * 1505 * <pre> 1506 * Additional context that may accompany the image(s) in the file. 1507 * </pre> 1508 * 1509 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1510 */ getImageContextOrBuilder()1511 public com.google.cloud.vision.v1.ImageContextOrBuilder getImageContextOrBuilder() { 1512 if (imageContextBuilder_ != null) { 1513 return imageContextBuilder_.getMessageOrBuilder(); 1514 } else { 1515 return imageContext_ == null 1516 ? com.google.cloud.vision.v1.ImageContext.getDefaultInstance() 1517 : imageContext_; 1518 } 1519 } 1520 /** 1521 * 1522 * 1523 * <pre> 1524 * Additional context that may accompany the image(s) in the file. 1525 * </pre> 1526 * 1527 * <code>.google.cloud.vision.v1.ImageContext image_context = 3;</code> 1528 */ 1529 private com.google.protobuf.SingleFieldBuilderV3< 1530 com.google.cloud.vision.v1.ImageContext, 1531 com.google.cloud.vision.v1.ImageContext.Builder, 1532 com.google.cloud.vision.v1.ImageContextOrBuilder> getImageContextFieldBuilder()1533 getImageContextFieldBuilder() { 1534 if (imageContextBuilder_ == null) { 1535 imageContextBuilder_ = 1536 new com.google.protobuf.SingleFieldBuilderV3< 1537 com.google.cloud.vision.v1.ImageContext, 1538 com.google.cloud.vision.v1.ImageContext.Builder, 1539 com.google.cloud.vision.v1.ImageContextOrBuilder>( 1540 getImageContext(), getParentForChildren(), isClean()); 1541 imageContext_ = null; 1542 } 1543 return imageContextBuilder_; 1544 } 1545 1546 private com.google.protobuf.Internal.IntList pages_ = emptyIntList(); 1547 ensurePagesIsMutable()1548 private void ensurePagesIsMutable() { 1549 if (!((bitField0_ & 0x00000008) != 0)) { 1550 pages_ = mutableCopy(pages_); 1551 bitField0_ |= 0x00000008; 1552 } 1553 } 1554 /** 1555 * 1556 * 1557 * <pre> 1558 * Pages of the file to perform image annotation. 1559 * Pages starts from 1, we assume the first page of the file is page 1. 1560 * At most 5 pages are supported per request. Pages can be negative. 1561 * Page 1 means the first page. 1562 * Page 2 means the second page. 1563 * Page -1 means the last page. 1564 * Page -2 means the second to the last page. 1565 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 1566 * If this field is empty, by default the service performs image annotation 1567 * for the first 5 pages of the file. 1568 * </pre> 1569 * 1570 * <code>repeated int32 pages = 4;</code> 1571 * 1572 * @return A list containing the pages. 1573 */ getPagesList()1574 public java.util.List<java.lang.Integer> getPagesList() { 1575 return ((bitField0_ & 0x00000008) != 0) 1576 ? java.util.Collections.unmodifiableList(pages_) 1577 : pages_; 1578 } 1579 /** 1580 * 1581 * 1582 * <pre> 1583 * Pages of the file to perform image annotation. 1584 * Pages starts from 1, we assume the first page of the file is page 1. 1585 * At most 5 pages are supported per request. Pages can be negative. 1586 * Page 1 means the first page. 1587 * Page 2 means the second page. 1588 * Page -1 means the last page. 1589 * Page -2 means the second to the last page. 1590 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 1591 * If this field is empty, by default the service performs image annotation 1592 * for the first 5 pages of the file. 1593 * </pre> 1594 * 1595 * <code>repeated int32 pages = 4;</code> 1596 * 1597 * @return The count of pages. 1598 */ getPagesCount()1599 public int getPagesCount() { 1600 return pages_.size(); 1601 } 1602 /** 1603 * 1604 * 1605 * <pre> 1606 * Pages of the file to perform image annotation. 1607 * Pages starts from 1, we assume the first page of the file is page 1. 1608 * At most 5 pages are supported per request. Pages can be negative. 1609 * Page 1 means the first page. 1610 * Page 2 means the second page. 1611 * Page -1 means the last page. 1612 * Page -2 means the second to the last page. 1613 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 1614 * If this field is empty, by default the service performs image annotation 1615 * for the first 5 pages of the file. 1616 * </pre> 1617 * 1618 * <code>repeated int32 pages = 4;</code> 1619 * 1620 * @param index The index of the element to return. 1621 * @return The pages at the given index. 1622 */ getPages(int index)1623 public int getPages(int index) { 1624 return pages_.getInt(index); 1625 } 1626 /** 1627 * 1628 * 1629 * <pre> 1630 * Pages of the file to perform image annotation. 1631 * Pages starts from 1, we assume the first page of the file is page 1. 1632 * At most 5 pages are supported per request. Pages can be negative. 1633 * Page 1 means the first page. 1634 * Page 2 means the second page. 1635 * Page -1 means the last page. 1636 * Page -2 means the second to the last page. 1637 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 1638 * If this field is empty, by default the service performs image annotation 1639 * for the first 5 pages of the file. 1640 * </pre> 1641 * 1642 * <code>repeated int32 pages = 4;</code> 1643 * 1644 * @param index The index to set the value at. 1645 * @param value The pages to set. 1646 * @return This builder for chaining. 1647 */ setPages(int index, int value)1648 public Builder setPages(int index, int value) { 1649 1650 ensurePagesIsMutable(); 1651 pages_.setInt(index, value); 1652 onChanged(); 1653 return this; 1654 } 1655 /** 1656 * 1657 * 1658 * <pre> 1659 * Pages of the file to perform image annotation. 1660 * Pages starts from 1, we assume the first page of the file is page 1. 1661 * At most 5 pages are supported per request. Pages can be negative. 1662 * Page 1 means the first page. 1663 * Page 2 means the second page. 1664 * Page -1 means the last page. 1665 * Page -2 means the second to the last page. 1666 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 1667 * If this field is empty, by default the service performs image annotation 1668 * for the first 5 pages of the file. 1669 * </pre> 1670 * 1671 * <code>repeated int32 pages = 4;</code> 1672 * 1673 * @param value The pages to add. 1674 * @return This builder for chaining. 1675 */ addPages(int value)1676 public Builder addPages(int value) { 1677 1678 ensurePagesIsMutable(); 1679 pages_.addInt(value); 1680 onChanged(); 1681 return this; 1682 } 1683 /** 1684 * 1685 * 1686 * <pre> 1687 * Pages of the file to perform image annotation. 1688 * Pages starts from 1, we assume the first page of the file is page 1. 1689 * At most 5 pages are supported per request. Pages can be negative. 1690 * Page 1 means the first page. 1691 * Page 2 means the second page. 1692 * Page -1 means the last page. 1693 * Page -2 means the second to the last page. 1694 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 1695 * If this field is empty, by default the service performs image annotation 1696 * for the first 5 pages of the file. 1697 * </pre> 1698 * 1699 * <code>repeated int32 pages = 4;</code> 1700 * 1701 * @param values The pages to add. 1702 * @return This builder for chaining. 1703 */ addAllPages(java.lang.Iterable<? extends java.lang.Integer> values)1704 public Builder addAllPages(java.lang.Iterable<? extends java.lang.Integer> values) { 1705 ensurePagesIsMutable(); 1706 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, pages_); 1707 onChanged(); 1708 return this; 1709 } 1710 /** 1711 * 1712 * 1713 * <pre> 1714 * Pages of the file to perform image annotation. 1715 * Pages starts from 1, we assume the first page of the file is page 1. 1716 * At most 5 pages are supported per request. Pages can be negative. 1717 * Page 1 means the first page. 1718 * Page 2 means the second page. 1719 * Page -1 means the last page. 1720 * Page -2 means the second to the last page. 1721 * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. 1722 * If this field is empty, by default the service performs image annotation 1723 * for the first 5 pages of the file. 1724 * </pre> 1725 * 1726 * <code>repeated int32 pages = 4;</code> 1727 * 1728 * @return This builder for chaining. 1729 */ clearPages()1730 public Builder clearPages() { 1731 pages_ = emptyIntList(); 1732 bitField0_ = (bitField0_ & ~0x00000008); 1733 onChanged(); 1734 return this; 1735 } 1736 1737 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1738 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 1739 return super.setUnknownFields(unknownFields); 1740 } 1741 1742 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1743 public final Builder mergeUnknownFields( 1744 final com.google.protobuf.UnknownFieldSet unknownFields) { 1745 return super.mergeUnknownFields(unknownFields); 1746 } 1747 1748 // @@protoc_insertion_point(builder_scope:google.cloud.vision.v1.AnnotateFileRequest) 1749 } 1750 1751 // @@protoc_insertion_point(class_scope:google.cloud.vision.v1.AnnotateFileRequest) 1752 private static final com.google.cloud.vision.v1.AnnotateFileRequest DEFAULT_INSTANCE; 1753 1754 static { 1755 DEFAULT_INSTANCE = new com.google.cloud.vision.v1.AnnotateFileRequest(); 1756 } 1757 getDefaultInstance()1758 public static com.google.cloud.vision.v1.AnnotateFileRequest getDefaultInstance() { 1759 return DEFAULT_INSTANCE; 1760 } 1761 1762 private static final com.google.protobuf.Parser<AnnotateFileRequest> PARSER = 1763 new com.google.protobuf.AbstractParser<AnnotateFileRequest>() { 1764 @java.lang.Override 1765 public AnnotateFileRequest parsePartialFrom( 1766 com.google.protobuf.CodedInputStream input, 1767 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1768 throws com.google.protobuf.InvalidProtocolBufferException { 1769 Builder builder = newBuilder(); 1770 try { 1771 builder.mergeFrom(input, extensionRegistry); 1772 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1773 throw e.setUnfinishedMessage(builder.buildPartial()); 1774 } catch (com.google.protobuf.UninitializedMessageException e) { 1775 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 1776 } catch (java.io.IOException e) { 1777 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1778 .setUnfinishedMessage(builder.buildPartial()); 1779 } 1780 return builder.buildPartial(); 1781 } 1782 }; 1783 parser()1784 public static com.google.protobuf.Parser<AnnotateFileRequest> parser() { 1785 return PARSER; 1786 } 1787 1788 @java.lang.Override getParserForType()1789 public com.google.protobuf.Parser<AnnotateFileRequest> getParserForType() { 1790 return PARSER; 1791 } 1792 1793 @java.lang.Override getDefaultInstanceForType()1794 public com.google.cloud.vision.v1.AnnotateFileRequest getDefaultInstanceForType() { 1795 return DEFAULT_INSTANCE; 1796 } 1797 } 1798