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