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/retail/v2/prediction_service.proto 18 19 package com.google.cloud.retail.v2; 20 21 /** 22 * 23 * 24 * <pre> 25 * Response message for predict method. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.retail.v2.PredictResponse} 29 */ 30 public final class PredictResponse extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PredictResponse) 33 PredictResponseOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use PredictResponse.newBuilder() to construct. PredictResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private PredictResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 PredictResponse()40 private PredictResponse() { 41 results_ = java.util.Collections.emptyList(); 42 attributionToken_ = ""; 43 missingIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; 44 } 45 46 @java.lang.Override 47 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)48 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 49 return new PredictResponse(); 50 } 51 52 @java.lang.Override getUnknownFields()53 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 54 return this.unknownFields; 55 } 56 getDescriptor()57 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 58 return com.google.cloud.retail.v2.PredictionServiceProto 59 .internal_static_google_cloud_retail_v2_PredictResponse_descriptor; 60 } 61 62 @java.lang.Override 63 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()64 internalGetFieldAccessorTable() { 65 return com.google.cloud.retail.v2.PredictionServiceProto 66 .internal_static_google_cloud_retail_v2_PredictResponse_fieldAccessorTable 67 .ensureFieldAccessorsInitialized( 68 com.google.cloud.retail.v2.PredictResponse.class, 69 com.google.cloud.retail.v2.PredictResponse.Builder.class); 70 } 71 72 public interface PredictionResultOrBuilder 73 extends 74 // @@protoc_insertion_point(interface_extends:google.cloud.retail.v2.PredictResponse.PredictionResult) 75 com.google.protobuf.MessageOrBuilder { 76 77 /** 78 * 79 * 80 * <pre> 81 * ID of the recommended product 82 * </pre> 83 * 84 * <code>string id = 1;</code> 85 * 86 * @return The id. 87 */ getId()88 java.lang.String getId(); 89 /** 90 * 91 * 92 * <pre> 93 * ID of the recommended product 94 * </pre> 95 * 96 * <code>string id = 1;</code> 97 * 98 * @return The bytes for id. 99 */ getIdBytes()100 com.google.protobuf.ByteString getIdBytes(); 101 102 /** 103 * 104 * 105 * <pre> 106 * Additional product metadata / annotations. 107 * Possible values: 108 * * `product`: JSON representation of the product. Is set if 109 * `returnProduct` is set to true in `PredictRequest.params`. 110 * * `score`: Prediction score in double value. Is set if 111 * `returnScore` is set to true in `PredictRequest.params`. 112 * </pre> 113 * 114 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 115 */ getMetadataCount()116 int getMetadataCount(); 117 /** 118 * 119 * 120 * <pre> 121 * Additional product metadata / annotations. 122 * Possible values: 123 * * `product`: JSON representation of the product. Is set if 124 * `returnProduct` is set to true in `PredictRequest.params`. 125 * * `score`: Prediction score in double value. Is set if 126 * `returnScore` is set to true in `PredictRequest.params`. 127 * </pre> 128 * 129 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 130 */ containsMetadata(java.lang.String key)131 boolean containsMetadata(java.lang.String key); 132 /** Use {@link #getMetadataMap()} instead. */ 133 @java.lang.Deprecated getMetadata()134 java.util.Map<java.lang.String, com.google.protobuf.Value> getMetadata(); 135 /** 136 * 137 * 138 * <pre> 139 * Additional product metadata / annotations. 140 * Possible values: 141 * * `product`: JSON representation of the product. Is set if 142 * `returnProduct` is set to true in `PredictRequest.params`. 143 * * `score`: Prediction score in double value. Is set if 144 * `returnScore` is set to true in `PredictRequest.params`. 145 * </pre> 146 * 147 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 148 */ getMetadataMap()149 java.util.Map<java.lang.String, com.google.protobuf.Value> getMetadataMap(); 150 /** 151 * 152 * 153 * <pre> 154 * Additional product metadata / annotations. 155 * Possible values: 156 * * `product`: JSON representation of the product. Is set if 157 * `returnProduct` is set to true in `PredictRequest.params`. 158 * * `score`: Prediction score in double value. Is set if 159 * `returnScore` is set to true in `PredictRequest.params`. 160 * </pre> 161 * 162 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 163 */ 164 /* nullable */ getMetadataOrDefault( java.lang.String key, com.google.protobuf.Value defaultValue)165 com.google.protobuf.Value getMetadataOrDefault( 166 java.lang.String key, 167 /* nullable */ 168 com.google.protobuf.Value defaultValue); 169 /** 170 * 171 * 172 * <pre> 173 * Additional product metadata / annotations. 174 * Possible values: 175 * * `product`: JSON representation of the product. Is set if 176 * `returnProduct` is set to true in `PredictRequest.params`. 177 * * `score`: Prediction score in double value. Is set if 178 * `returnScore` is set to true in `PredictRequest.params`. 179 * </pre> 180 * 181 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 182 */ getMetadataOrThrow(java.lang.String key)183 com.google.protobuf.Value getMetadataOrThrow(java.lang.String key); 184 } 185 /** 186 * 187 * 188 * <pre> 189 * PredictionResult represents the recommendation prediction results. 190 * </pre> 191 * 192 * Protobuf type {@code google.cloud.retail.v2.PredictResponse.PredictionResult} 193 */ 194 public static final class PredictionResult extends com.google.protobuf.GeneratedMessageV3 195 implements 196 // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PredictResponse.PredictionResult) 197 PredictionResultOrBuilder { 198 private static final long serialVersionUID = 0L; 199 // Use PredictionResult.newBuilder() to construct. PredictionResult(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)200 private PredictionResult(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 201 super(builder); 202 } 203 PredictionResult()204 private PredictionResult() { 205 id_ = ""; 206 } 207 208 @java.lang.Override 209 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)210 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 211 return new PredictionResult(); 212 } 213 214 @java.lang.Override getUnknownFields()215 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 216 return this.unknownFields; 217 } 218 getDescriptor()219 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 220 return com.google.cloud.retail.v2.PredictionServiceProto 221 .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_descriptor; 222 } 223 224 @SuppressWarnings({"rawtypes"}) 225 @java.lang.Override internalGetMapField(int number)226 protected com.google.protobuf.MapField internalGetMapField(int number) { 227 switch (number) { 228 case 2: 229 return internalGetMetadata(); 230 default: 231 throw new RuntimeException("Invalid map field number: " + number); 232 } 233 } 234 235 @java.lang.Override 236 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()237 internalGetFieldAccessorTable() { 238 return com.google.cloud.retail.v2.PredictionServiceProto 239 .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_fieldAccessorTable 240 .ensureFieldAccessorsInitialized( 241 com.google.cloud.retail.v2.PredictResponse.PredictionResult.class, 242 com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder.class); 243 } 244 245 public static final int ID_FIELD_NUMBER = 1; 246 247 @SuppressWarnings("serial") 248 private volatile java.lang.Object id_ = ""; 249 /** 250 * 251 * 252 * <pre> 253 * ID of the recommended product 254 * </pre> 255 * 256 * <code>string id = 1;</code> 257 * 258 * @return The id. 259 */ 260 @java.lang.Override getId()261 public java.lang.String getId() { 262 java.lang.Object ref = id_; 263 if (ref instanceof java.lang.String) { 264 return (java.lang.String) ref; 265 } else { 266 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 267 java.lang.String s = bs.toStringUtf8(); 268 id_ = s; 269 return s; 270 } 271 } 272 /** 273 * 274 * 275 * <pre> 276 * ID of the recommended product 277 * </pre> 278 * 279 * <code>string id = 1;</code> 280 * 281 * @return The bytes for id. 282 */ 283 @java.lang.Override getIdBytes()284 public com.google.protobuf.ByteString getIdBytes() { 285 java.lang.Object ref = id_; 286 if (ref instanceof java.lang.String) { 287 com.google.protobuf.ByteString b = 288 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 289 id_ = b; 290 return b; 291 } else { 292 return (com.google.protobuf.ByteString) ref; 293 } 294 } 295 296 public static final int METADATA_FIELD_NUMBER = 2; 297 298 private static final class MetadataDefaultEntryHolder { 299 static final com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> 300 defaultEntry = 301 com.google.protobuf.MapEntry 302 .<java.lang.String, com.google.protobuf.Value>newDefaultInstance( 303 com.google.cloud.retail.v2.PredictionServiceProto 304 .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_MetadataEntry_descriptor, 305 com.google.protobuf.WireFormat.FieldType.STRING, 306 "", 307 com.google.protobuf.WireFormat.FieldType.MESSAGE, 308 com.google.protobuf.Value.getDefaultInstance()); 309 } 310 311 @SuppressWarnings("serial") 312 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> metadata_; 313 314 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetMetadata()315 internalGetMetadata() { 316 if (metadata_ == null) { 317 return com.google.protobuf.MapField.emptyMapField(MetadataDefaultEntryHolder.defaultEntry); 318 } 319 return metadata_; 320 } 321 getMetadataCount()322 public int getMetadataCount() { 323 return internalGetMetadata().getMap().size(); 324 } 325 /** 326 * 327 * 328 * <pre> 329 * Additional product metadata / annotations. 330 * Possible values: 331 * * `product`: JSON representation of the product. Is set if 332 * `returnProduct` is set to true in `PredictRequest.params`. 333 * * `score`: Prediction score in double value. Is set if 334 * `returnScore` is set to true in `PredictRequest.params`. 335 * </pre> 336 * 337 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 338 */ 339 @java.lang.Override containsMetadata(java.lang.String key)340 public boolean containsMetadata(java.lang.String key) { 341 if (key == null) { 342 throw new NullPointerException("map key"); 343 } 344 return internalGetMetadata().getMap().containsKey(key); 345 } 346 /** Use {@link #getMetadataMap()} instead. */ 347 @java.lang.Override 348 @java.lang.Deprecated getMetadata()349 public java.util.Map<java.lang.String, com.google.protobuf.Value> getMetadata() { 350 return getMetadataMap(); 351 } 352 /** 353 * 354 * 355 * <pre> 356 * Additional product metadata / annotations. 357 * Possible values: 358 * * `product`: JSON representation of the product. Is set if 359 * `returnProduct` is set to true in `PredictRequest.params`. 360 * * `score`: Prediction score in double value. Is set if 361 * `returnScore` is set to true in `PredictRequest.params`. 362 * </pre> 363 * 364 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 365 */ 366 @java.lang.Override getMetadataMap()367 public java.util.Map<java.lang.String, com.google.protobuf.Value> getMetadataMap() { 368 return internalGetMetadata().getMap(); 369 } 370 /** 371 * 372 * 373 * <pre> 374 * Additional product metadata / annotations. 375 * Possible values: 376 * * `product`: JSON representation of the product. Is set if 377 * `returnProduct` is set to true in `PredictRequest.params`. 378 * * `score`: Prediction score in double value. Is set if 379 * `returnScore` is set to true in `PredictRequest.params`. 380 * </pre> 381 * 382 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 383 */ 384 @java.lang.Override getMetadataOrDefault( java.lang.String key, com.google.protobuf.Value defaultValue)385 public /* nullable */ com.google.protobuf.Value getMetadataOrDefault( 386 java.lang.String key, 387 /* nullable */ 388 com.google.protobuf.Value defaultValue) { 389 if (key == null) { 390 throw new NullPointerException("map key"); 391 } 392 java.util.Map<java.lang.String, com.google.protobuf.Value> map = 393 internalGetMetadata().getMap(); 394 return map.containsKey(key) ? map.get(key) : defaultValue; 395 } 396 /** 397 * 398 * 399 * <pre> 400 * Additional product metadata / annotations. 401 * Possible values: 402 * * `product`: JSON representation of the product. Is set if 403 * `returnProduct` is set to true in `PredictRequest.params`. 404 * * `score`: Prediction score in double value. Is set if 405 * `returnScore` is set to true in `PredictRequest.params`. 406 * </pre> 407 * 408 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 409 */ 410 @java.lang.Override getMetadataOrThrow(java.lang.String key)411 public com.google.protobuf.Value getMetadataOrThrow(java.lang.String key) { 412 if (key == null) { 413 throw new NullPointerException("map key"); 414 } 415 java.util.Map<java.lang.String, com.google.protobuf.Value> map = 416 internalGetMetadata().getMap(); 417 if (!map.containsKey(key)) { 418 throw new java.lang.IllegalArgumentException(); 419 } 420 return map.get(key); 421 } 422 423 private byte memoizedIsInitialized = -1; 424 425 @java.lang.Override isInitialized()426 public final boolean isInitialized() { 427 byte isInitialized = memoizedIsInitialized; 428 if (isInitialized == 1) return true; 429 if (isInitialized == 0) return false; 430 431 memoizedIsInitialized = 1; 432 return true; 433 } 434 435 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)436 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 437 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) { 438 com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_); 439 } 440 com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( 441 output, internalGetMetadata(), MetadataDefaultEntryHolder.defaultEntry, 2); 442 getUnknownFields().writeTo(output); 443 } 444 445 @java.lang.Override getSerializedSize()446 public int getSerializedSize() { 447 int size = memoizedSize; 448 if (size != -1) return size; 449 450 size = 0; 451 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) { 452 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_); 453 } 454 for (java.util.Map.Entry<java.lang.String, com.google.protobuf.Value> entry : 455 internalGetMetadata().getMap().entrySet()) { 456 com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> metadata__ = 457 MetadataDefaultEntryHolder.defaultEntry 458 .newBuilderForType() 459 .setKey(entry.getKey()) 460 .setValue(entry.getValue()) 461 .build(); 462 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, metadata__); 463 } 464 size += getUnknownFields().getSerializedSize(); 465 memoizedSize = size; 466 return size; 467 } 468 469 @java.lang.Override equals(final java.lang.Object obj)470 public boolean equals(final java.lang.Object obj) { 471 if (obj == this) { 472 return true; 473 } 474 if (!(obj instanceof com.google.cloud.retail.v2.PredictResponse.PredictionResult)) { 475 return super.equals(obj); 476 } 477 com.google.cloud.retail.v2.PredictResponse.PredictionResult other = 478 (com.google.cloud.retail.v2.PredictResponse.PredictionResult) obj; 479 480 if (!getId().equals(other.getId())) return false; 481 if (!internalGetMetadata().equals(other.internalGetMetadata())) return false; 482 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 483 return true; 484 } 485 486 @java.lang.Override hashCode()487 public int hashCode() { 488 if (memoizedHashCode != 0) { 489 return memoizedHashCode; 490 } 491 int hash = 41; 492 hash = (19 * hash) + getDescriptor().hashCode(); 493 hash = (37 * hash) + ID_FIELD_NUMBER; 494 hash = (53 * hash) + getId().hashCode(); 495 if (!internalGetMetadata().getMap().isEmpty()) { 496 hash = (37 * hash) + METADATA_FIELD_NUMBER; 497 hash = (53 * hash) + internalGetMetadata().hashCode(); 498 } 499 hash = (29 * hash) + getUnknownFields().hashCode(); 500 memoizedHashCode = hash; 501 return hash; 502 } 503 parseFrom( java.nio.ByteBuffer data)504 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 505 java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { 506 return PARSER.parseFrom(data); 507 } 508 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)509 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 510 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 511 throws com.google.protobuf.InvalidProtocolBufferException { 512 return PARSER.parseFrom(data, extensionRegistry); 513 } 514 parseFrom( com.google.protobuf.ByteString data)515 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 516 com.google.protobuf.ByteString data) 517 throws com.google.protobuf.InvalidProtocolBufferException { 518 return PARSER.parseFrom(data); 519 } 520 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)521 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 522 com.google.protobuf.ByteString data, 523 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 524 throws com.google.protobuf.InvalidProtocolBufferException { 525 return PARSER.parseFrom(data, extensionRegistry); 526 } 527 parseFrom(byte[] data)528 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom(byte[] data) 529 throws com.google.protobuf.InvalidProtocolBufferException { 530 return PARSER.parseFrom(data); 531 } 532 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)533 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 534 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 535 throws com.google.protobuf.InvalidProtocolBufferException { 536 return PARSER.parseFrom(data, extensionRegistry); 537 } 538 parseFrom( java.io.InputStream input)539 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 540 java.io.InputStream input) throws java.io.IOException { 541 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 542 } 543 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)544 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 545 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 546 throws java.io.IOException { 547 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 548 PARSER, input, extensionRegistry); 549 } 550 parseDelimitedFrom( java.io.InputStream input)551 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseDelimitedFrom( 552 java.io.InputStream input) throws java.io.IOException { 553 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 554 } 555 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)556 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseDelimitedFrom( 557 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 558 throws java.io.IOException { 559 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 560 PARSER, input, extensionRegistry); 561 } 562 parseFrom( com.google.protobuf.CodedInputStream input)563 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 564 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 565 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 566 } 567 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)568 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult parseFrom( 569 com.google.protobuf.CodedInputStream input, 570 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 571 throws java.io.IOException { 572 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 573 PARSER, input, extensionRegistry); 574 } 575 576 @java.lang.Override newBuilderForType()577 public Builder newBuilderForType() { 578 return newBuilder(); 579 } 580 newBuilder()581 public static Builder newBuilder() { 582 return DEFAULT_INSTANCE.toBuilder(); 583 } 584 newBuilder( com.google.cloud.retail.v2.PredictResponse.PredictionResult prototype)585 public static Builder newBuilder( 586 com.google.cloud.retail.v2.PredictResponse.PredictionResult prototype) { 587 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 588 } 589 590 @java.lang.Override toBuilder()591 public Builder toBuilder() { 592 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 593 } 594 595 @java.lang.Override newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent)596 protected Builder newBuilderForType( 597 com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 598 Builder builder = new Builder(parent); 599 return builder; 600 } 601 /** 602 * 603 * 604 * <pre> 605 * PredictionResult represents the recommendation prediction results. 606 * </pre> 607 * 608 * Protobuf type {@code google.cloud.retail.v2.PredictResponse.PredictionResult} 609 */ 610 public static final class Builder 611 extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 612 implements 613 // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PredictResponse.PredictionResult) 614 com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder { getDescriptor()615 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 616 return com.google.cloud.retail.v2.PredictionServiceProto 617 .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_descriptor; 618 } 619 620 @SuppressWarnings({"rawtypes"}) internalGetMapField(int number)621 protected com.google.protobuf.MapField internalGetMapField(int number) { 622 switch (number) { 623 case 2: 624 return internalGetMetadata(); 625 default: 626 throw new RuntimeException("Invalid map field number: " + number); 627 } 628 } 629 630 @SuppressWarnings({"rawtypes"}) internalGetMutableMapField(int number)631 protected com.google.protobuf.MapField internalGetMutableMapField(int number) { 632 switch (number) { 633 case 2: 634 return internalGetMutableMetadata(); 635 default: 636 throw new RuntimeException("Invalid map field number: " + number); 637 } 638 } 639 640 @java.lang.Override 641 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()642 internalGetFieldAccessorTable() { 643 return com.google.cloud.retail.v2.PredictionServiceProto 644 .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_fieldAccessorTable 645 .ensureFieldAccessorsInitialized( 646 com.google.cloud.retail.v2.PredictResponse.PredictionResult.class, 647 com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder.class); 648 } 649 650 // Construct using com.google.cloud.retail.v2.PredictResponse.PredictionResult.newBuilder() Builder()651 private Builder() {} 652 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)653 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 654 super(parent); 655 } 656 657 @java.lang.Override clear()658 public Builder clear() { 659 super.clear(); 660 bitField0_ = 0; 661 id_ = ""; 662 internalGetMutableMetadata().clear(); 663 return this; 664 } 665 666 @java.lang.Override getDescriptorForType()667 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 668 return com.google.cloud.retail.v2.PredictionServiceProto 669 .internal_static_google_cloud_retail_v2_PredictResponse_PredictionResult_descriptor; 670 } 671 672 @java.lang.Override 673 public com.google.cloud.retail.v2.PredictResponse.PredictionResult getDefaultInstanceForType()674 getDefaultInstanceForType() { 675 return com.google.cloud.retail.v2.PredictResponse.PredictionResult.getDefaultInstance(); 676 } 677 678 @java.lang.Override build()679 public com.google.cloud.retail.v2.PredictResponse.PredictionResult build() { 680 com.google.cloud.retail.v2.PredictResponse.PredictionResult result = buildPartial(); 681 if (!result.isInitialized()) { 682 throw newUninitializedMessageException(result); 683 } 684 return result; 685 } 686 687 @java.lang.Override buildPartial()688 public com.google.cloud.retail.v2.PredictResponse.PredictionResult buildPartial() { 689 com.google.cloud.retail.v2.PredictResponse.PredictionResult result = 690 new com.google.cloud.retail.v2.PredictResponse.PredictionResult(this); 691 if (bitField0_ != 0) { 692 buildPartial0(result); 693 } 694 onBuilt(); 695 return result; 696 } 697 buildPartial0( com.google.cloud.retail.v2.PredictResponse.PredictionResult result)698 private void buildPartial0( 699 com.google.cloud.retail.v2.PredictResponse.PredictionResult result) { 700 int from_bitField0_ = bitField0_; 701 if (((from_bitField0_ & 0x00000001) != 0)) { 702 result.id_ = id_; 703 } 704 if (((from_bitField0_ & 0x00000002) != 0)) { 705 result.metadata_ = internalGetMetadata(); 706 result.metadata_.makeImmutable(); 707 } 708 } 709 710 @java.lang.Override clone()711 public Builder clone() { 712 return super.clone(); 713 } 714 715 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)716 public Builder setField( 717 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 718 return super.setField(field, value); 719 } 720 721 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)722 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 723 return super.clearField(field); 724 } 725 726 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)727 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 728 return super.clearOneof(oneof); 729 } 730 731 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)732 public Builder setRepeatedField( 733 com.google.protobuf.Descriptors.FieldDescriptor field, 734 int index, 735 java.lang.Object value) { 736 return super.setRepeatedField(field, index, value); 737 } 738 739 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)740 public Builder addRepeatedField( 741 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 742 return super.addRepeatedField(field, value); 743 } 744 745 @java.lang.Override mergeFrom(com.google.protobuf.Message other)746 public Builder mergeFrom(com.google.protobuf.Message other) { 747 if (other instanceof com.google.cloud.retail.v2.PredictResponse.PredictionResult) { 748 return mergeFrom((com.google.cloud.retail.v2.PredictResponse.PredictionResult) other); 749 } else { 750 super.mergeFrom(other); 751 return this; 752 } 753 } 754 mergeFrom(com.google.cloud.retail.v2.PredictResponse.PredictionResult other)755 public Builder mergeFrom(com.google.cloud.retail.v2.PredictResponse.PredictionResult other) { 756 if (other 757 == com.google.cloud.retail.v2.PredictResponse.PredictionResult.getDefaultInstance()) 758 return this; 759 if (!other.getId().isEmpty()) { 760 id_ = other.id_; 761 bitField0_ |= 0x00000001; 762 onChanged(); 763 } 764 internalGetMutableMetadata().mergeFrom(other.internalGetMetadata()); 765 bitField0_ |= 0x00000002; 766 this.mergeUnknownFields(other.getUnknownFields()); 767 onChanged(); 768 return this; 769 } 770 771 @java.lang.Override isInitialized()772 public final boolean isInitialized() { 773 return true; 774 } 775 776 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)777 public Builder mergeFrom( 778 com.google.protobuf.CodedInputStream input, 779 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 780 throws java.io.IOException { 781 if (extensionRegistry == null) { 782 throw new java.lang.NullPointerException(); 783 } 784 try { 785 boolean done = false; 786 while (!done) { 787 int tag = input.readTag(); 788 switch (tag) { 789 case 0: 790 done = true; 791 break; 792 case 10: 793 { 794 id_ = input.readStringRequireUtf8(); 795 bitField0_ |= 0x00000001; 796 break; 797 } // case 10 798 case 18: 799 { 800 com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> 801 metadata__ = 802 input.readMessage( 803 MetadataDefaultEntryHolder.defaultEntry.getParserForType(), 804 extensionRegistry); 805 internalGetMutableMetadata() 806 .getMutableMap() 807 .put(metadata__.getKey(), metadata__.getValue()); 808 bitField0_ |= 0x00000002; 809 break; 810 } // case 18 811 default: 812 { 813 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 814 done = true; // was an endgroup tag 815 } 816 break; 817 } // default: 818 } // switch (tag) 819 } // while (!done) 820 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 821 throw e.unwrapIOException(); 822 } finally { 823 onChanged(); 824 } // finally 825 return this; 826 } 827 828 private int bitField0_; 829 830 private java.lang.Object id_ = ""; 831 /** 832 * 833 * 834 * <pre> 835 * ID of the recommended product 836 * </pre> 837 * 838 * <code>string id = 1;</code> 839 * 840 * @return The id. 841 */ getId()842 public java.lang.String getId() { 843 java.lang.Object ref = id_; 844 if (!(ref instanceof java.lang.String)) { 845 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 846 java.lang.String s = bs.toStringUtf8(); 847 id_ = s; 848 return s; 849 } else { 850 return (java.lang.String) ref; 851 } 852 } 853 /** 854 * 855 * 856 * <pre> 857 * ID of the recommended product 858 * </pre> 859 * 860 * <code>string id = 1;</code> 861 * 862 * @return The bytes for id. 863 */ getIdBytes()864 public com.google.protobuf.ByteString getIdBytes() { 865 java.lang.Object ref = id_; 866 if (ref instanceof String) { 867 com.google.protobuf.ByteString b = 868 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 869 id_ = b; 870 return b; 871 } else { 872 return (com.google.protobuf.ByteString) ref; 873 } 874 } 875 /** 876 * 877 * 878 * <pre> 879 * ID of the recommended product 880 * </pre> 881 * 882 * <code>string id = 1;</code> 883 * 884 * @param value The id to set. 885 * @return This builder for chaining. 886 */ setId(java.lang.String value)887 public Builder setId(java.lang.String value) { 888 if (value == null) { 889 throw new NullPointerException(); 890 } 891 id_ = value; 892 bitField0_ |= 0x00000001; 893 onChanged(); 894 return this; 895 } 896 /** 897 * 898 * 899 * <pre> 900 * ID of the recommended product 901 * </pre> 902 * 903 * <code>string id = 1;</code> 904 * 905 * @return This builder for chaining. 906 */ clearId()907 public Builder clearId() { 908 id_ = getDefaultInstance().getId(); 909 bitField0_ = (bitField0_ & ~0x00000001); 910 onChanged(); 911 return this; 912 } 913 /** 914 * 915 * 916 * <pre> 917 * ID of the recommended product 918 * </pre> 919 * 920 * <code>string id = 1;</code> 921 * 922 * @param value The bytes for id to set. 923 * @return This builder for chaining. 924 */ setIdBytes(com.google.protobuf.ByteString value)925 public Builder setIdBytes(com.google.protobuf.ByteString value) { 926 if (value == null) { 927 throw new NullPointerException(); 928 } 929 checkByteStringIsUtf8(value); 930 id_ = value; 931 bitField0_ |= 0x00000001; 932 onChanged(); 933 return this; 934 } 935 936 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> metadata_; 937 938 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetMetadata()939 internalGetMetadata() { 940 if (metadata_ == null) { 941 return com.google.protobuf.MapField.emptyMapField( 942 MetadataDefaultEntryHolder.defaultEntry); 943 } 944 return metadata_; 945 } 946 947 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetMutableMetadata()948 internalGetMutableMetadata() { 949 if (metadata_ == null) { 950 metadata_ = 951 com.google.protobuf.MapField.newMapField(MetadataDefaultEntryHolder.defaultEntry); 952 } 953 if (!metadata_.isMutable()) { 954 metadata_ = metadata_.copy(); 955 } 956 bitField0_ |= 0x00000002; 957 onChanged(); 958 return metadata_; 959 } 960 getMetadataCount()961 public int getMetadataCount() { 962 return internalGetMetadata().getMap().size(); 963 } 964 /** 965 * 966 * 967 * <pre> 968 * Additional product metadata / annotations. 969 * Possible values: 970 * * `product`: JSON representation of the product. Is set if 971 * `returnProduct` is set to true in `PredictRequest.params`. 972 * * `score`: Prediction score in double value. Is set if 973 * `returnScore` is set to true in `PredictRequest.params`. 974 * </pre> 975 * 976 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 977 */ 978 @java.lang.Override containsMetadata(java.lang.String key)979 public boolean containsMetadata(java.lang.String key) { 980 if (key == null) { 981 throw new NullPointerException("map key"); 982 } 983 return internalGetMetadata().getMap().containsKey(key); 984 } 985 /** Use {@link #getMetadataMap()} instead. */ 986 @java.lang.Override 987 @java.lang.Deprecated getMetadata()988 public java.util.Map<java.lang.String, com.google.protobuf.Value> getMetadata() { 989 return getMetadataMap(); 990 } 991 /** 992 * 993 * 994 * <pre> 995 * Additional product metadata / annotations. 996 * Possible values: 997 * * `product`: JSON representation of the product. Is set if 998 * `returnProduct` is set to true in `PredictRequest.params`. 999 * * `score`: Prediction score in double value. Is set if 1000 * `returnScore` is set to true in `PredictRequest.params`. 1001 * </pre> 1002 * 1003 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 1004 */ 1005 @java.lang.Override getMetadataMap()1006 public java.util.Map<java.lang.String, com.google.protobuf.Value> getMetadataMap() { 1007 return internalGetMetadata().getMap(); 1008 } 1009 /** 1010 * 1011 * 1012 * <pre> 1013 * Additional product metadata / annotations. 1014 * Possible values: 1015 * * `product`: JSON representation of the product. Is set if 1016 * `returnProduct` is set to true in `PredictRequest.params`. 1017 * * `score`: Prediction score in double value. Is set if 1018 * `returnScore` is set to true in `PredictRequest.params`. 1019 * </pre> 1020 * 1021 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 1022 */ 1023 @java.lang.Override getMetadataOrDefault( java.lang.String key, com.google.protobuf.Value defaultValue)1024 public /* nullable */ com.google.protobuf.Value getMetadataOrDefault( 1025 java.lang.String key, 1026 /* nullable */ 1027 com.google.protobuf.Value defaultValue) { 1028 if (key == null) { 1029 throw new NullPointerException("map key"); 1030 } 1031 java.util.Map<java.lang.String, com.google.protobuf.Value> map = 1032 internalGetMetadata().getMap(); 1033 return map.containsKey(key) ? map.get(key) : defaultValue; 1034 } 1035 /** 1036 * 1037 * 1038 * <pre> 1039 * Additional product metadata / annotations. 1040 * Possible values: 1041 * * `product`: JSON representation of the product. Is set if 1042 * `returnProduct` is set to true in `PredictRequest.params`. 1043 * * `score`: Prediction score in double value. Is set if 1044 * `returnScore` is set to true in `PredictRequest.params`. 1045 * </pre> 1046 * 1047 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 1048 */ 1049 @java.lang.Override getMetadataOrThrow(java.lang.String key)1050 public com.google.protobuf.Value getMetadataOrThrow(java.lang.String key) { 1051 if (key == null) { 1052 throw new NullPointerException("map key"); 1053 } 1054 java.util.Map<java.lang.String, com.google.protobuf.Value> map = 1055 internalGetMetadata().getMap(); 1056 if (!map.containsKey(key)) { 1057 throw new java.lang.IllegalArgumentException(); 1058 } 1059 return map.get(key); 1060 } 1061 clearMetadata()1062 public Builder clearMetadata() { 1063 bitField0_ = (bitField0_ & ~0x00000002); 1064 internalGetMutableMetadata().getMutableMap().clear(); 1065 return this; 1066 } 1067 /** 1068 * 1069 * 1070 * <pre> 1071 * Additional product metadata / annotations. 1072 * Possible values: 1073 * * `product`: JSON representation of the product. Is set if 1074 * `returnProduct` is set to true in `PredictRequest.params`. 1075 * * `score`: Prediction score in double value. Is set if 1076 * `returnScore` is set to true in `PredictRequest.params`. 1077 * </pre> 1078 * 1079 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 1080 */ removeMetadata(java.lang.String key)1081 public Builder removeMetadata(java.lang.String key) { 1082 if (key == null) { 1083 throw new NullPointerException("map key"); 1084 } 1085 internalGetMutableMetadata().getMutableMap().remove(key); 1086 return this; 1087 } 1088 /** Use alternate mutation accessors instead. */ 1089 @java.lang.Deprecated getMutableMetadata()1090 public java.util.Map<java.lang.String, com.google.protobuf.Value> getMutableMetadata() { 1091 bitField0_ |= 0x00000002; 1092 return internalGetMutableMetadata().getMutableMap(); 1093 } 1094 /** 1095 * 1096 * 1097 * <pre> 1098 * Additional product metadata / annotations. 1099 * Possible values: 1100 * * `product`: JSON representation of the product. Is set if 1101 * `returnProduct` is set to true in `PredictRequest.params`. 1102 * * `score`: Prediction score in double value. Is set if 1103 * `returnScore` is set to true in `PredictRequest.params`. 1104 * </pre> 1105 * 1106 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 1107 */ putMetadata(java.lang.String key, com.google.protobuf.Value value)1108 public Builder putMetadata(java.lang.String key, com.google.protobuf.Value value) { 1109 if (key == null) { 1110 throw new NullPointerException("map key"); 1111 } 1112 if (value == null) { 1113 throw new NullPointerException("map value"); 1114 } 1115 internalGetMutableMetadata().getMutableMap().put(key, value); 1116 bitField0_ |= 0x00000002; 1117 return this; 1118 } 1119 /** 1120 * 1121 * 1122 * <pre> 1123 * Additional product metadata / annotations. 1124 * Possible values: 1125 * * `product`: JSON representation of the product. Is set if 1126 * `returnProduct` is set to true in `PredictRequest.params`. 1127 * * `score`: Prediction score in double value. Is set if 1128 * `returnScore` is set to true in `PredictRequest.params`. 1129 * </pre> 1130 * 1131 * <code>map<string, .google.protobuf.Value> metadata = 2;</code> 1132 */ putAllMetadata( java.util.Map<java.lang.String, com.google.protobuf.Value> values)1133 public Builder putAllMetadata( 1134 java.util.Map<java.lang.String, com.google.protobuf.Value> values) { 1135 internalGetMutableMetadata().getMutableMap().putAll(values); 1136 bitField0_ |= 0x00000002; 1137 return this; 1138 } 1139 1140 @java.lang.Override setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1141 public final Builder setUnknownFields( 1142 final com.google.protobuf.UnknownFieldSet unknownFields) { 1143 return super.setUnknownFields(unknownFields); 1144 } 1145 1146 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1147 public final Builder mergeUnknownFields( 1148 final com.google.protobuf.UnknownFieldSet unknownFields) { 1149 return super.mergeUnknownFields(unknownFields); 1150 } 1151 1152 // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PredictResponse.PredictionResult) 1153 } 1154 1155 // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PredictResponse.PredictionResult) 1156 private static final com.google.cloud.retail.v2.PredictResponse.PredictionResult 1157 DEFAULT_INSTANCE; 1158 1159 static { 1160 DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PredictResponse.PredictionResult(); 1161 } 1162 getDefaultInstance()1163 public static com.google.cloud.retail.v2.PredictResponse.PredictionResult getDefaultInstance() { 1164 return DEFAULT_INSTANCE; 1165 } 1166 1167 private static final com.google.protobuf.Parser<PredictionResult> PARSER = 1168 new com.google.protobuf.AbstractParser<PredictionResult>() { 1169 @java.lang.Override 1170 public PredictionResult parsePartialFrom( 1171 com.google.protobuf.CodedInputStream input, 1172 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1173 throws com.google.protobuf.InvalidProtocolBufferException { 1174 Builder builder = newBuilder(); 1175 try { 1176 builder.mergeFrom(input, extensionRegistry); 1177 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1178 throw e.setUnfinishedMessage(builder.buildPartial()); 1179 } catch (com.google.protobuf.UninitializedMessageException e) { 1180 throw e.asInvalidProtocolBufferException() 1181 .setUnfinishedMessage(builder.buildPartial()); 1182 } catch (java.io.IOException e) { 1183 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1184 .setUnfinishedMessage(builder.buildPartial()); 1185 } 1186 return builder.buildPartial(); 1187 } 1188 }; 1189 parser()1190 public static com.google.protobuf.Parser<PredictionResult> parser() { 1191 return PARSER; 1192 } 1193 1194 @java.lang.Override getParserForType()1195 public com.google.protobuf.Parser<PredictionResult> getParserForType() { 1196 return PARSER; 1197 } 1198 1199 @java.lang.Override getDefaultInstanceForType()1200 public com.google.cloud.retail.v2.PredictResponse.PredictionResult getDefaultInstanceForType() { 1201 return DEFAULT_INSTANCE; 1202 } 1203 } 1204 1205 public static final int RESULTS_FIELD_NUMBER = 1; 1206 1207 @SuppressWarnings("serial") 1208 private java.util.List<com.google.cloud.retail.v2.PredictResponse.PredictionResult> results_; 1209 /** 1210 * 1211 * 1212 * <pre> 1213 * A list of recommended products. The order represents the ranking (from the 1214 * most relevant product to the least). 1215 * </pre> 1216 * 1217 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1218 */ 1219 @java.lang.Override 1220 public java.util.List<com.google.cloud.retail.v2.PredictResponse.PredictionResult> getResultsList()1221 getResultsList() { 1222 return results_; 1223 } 1224 /** 1225 * 1226 * 1227 * <pre> 1228 * A list of recommended products. The order represents the ranking (from the 1229 * most relevant product to the least). 1230 * </pre> 1231 * 1232 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1233 */ 1234 @java.lang.Override 1235 public java.util.List< 1236 ? extends com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder> getResultsOrBuilderList()1237 getResultsOrBuilderList() { 1238 return results_; 1239 } 1240 /** 1241 * 1242 * 1243 * <pre> 1244 * A list of recommended products. The order represents the ranking (from the 1245 * most relevant product to the least). 1246 * </pre> 1247 * 1248 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1249 */ 1250 @java.lang.Override getResultsCount()1251 public int getResultsCount() { 1252 return results_.size(); 1253 } 1254 /** 1255 * 1256 * 1257 * <pre> 1258 * A list of recommended products. The order represents the ranking (from the 1259 * most relevant product to the least). 1260 * </pre> 1261 * 1262 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1263 */ 1264 @java.lang.Override getResults(int index)1265 public com.google.cloud.retail.v2.PredictResponse.PredictionResult getResults(int index) { 1266 return results_.get(index); 1267 } 1268 /** 1269 * 1270 * 1271 * <pre> 1272 * A list of recommended products. The order represents the ranking (from the 1273 * most relevant product to the least). 1274 * </pre> 1275 * 1276 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1277 */ 1278 @java.lang.Override getResultsOrBuilder( int index)1279 public com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder getResultsOrBuilder( 1280 int index) { 1281 return results_.get(index); 1282 } 1283 1284 public static final int ATTRIBUTION_TOKEN_FIELD_NUMBER = 2; 1285 1286 @SuppressWarnings("serial") 1287 private volatile java.lang.Object attributionToken_ = ""; 1288 /** 1289 * 1290 * 1291 * <pre> 1292 * A unique attribution token. This should be included in the 1293 * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this 1294 * recommendation, which enables accurate attribution of recommendation model 1295 * performance. 1296 * </pre> 1297 * 1298 * <code>string attribution_token = 2;</code> 1299 * 1300 * @return The attributionToken. 1301 */ 1302 @java.lang.Override getAttributionToken()1303 public java.lang.String getAttributionToken() { 1304 java.lang.Object ref = attributionToken_; 1305 if (ref instanceof java.lang.String) { 1306 return (java.lang.String) ref; 1307 } else { 1308 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1309 java.lang.String s = bs.toStringUtf8(); 1310 attributionToken_ = s; 1311 return s; 1312 } 1313 } 1314 /** 1315 * 1316 * 1317 * <pre> 1318 * A unique attribution token. This should be included in the 1319 * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this 1320 * recommendation, which enables accurate attribution of recommendation model 1321 * performance. 1322 * </pre> 1323 * 1324 * <code>string attribution_token = 2;</code> 1325 * 1326 * @return The bytes for attributionToken. 1327 */ 1328 @java.lang.Override getAttributionTokenBytes()1329 public com.google.protobuf.ByteString getAttributionTokenBytes() { 1330 java.lang.Object ref = attributionToken_; 1331 if (ref instanceof java.lang.String) { 1332 com.google.protobuf.ByteString b = 1333 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1334 attributionToken_ = b; 1335 return b; 1336 } else { 1337 return (com.google.protobuf.ByteString) ref; 1338 } 1339 } 1340 1341 public static final int MISSING_IDS_FIELD_NUMBER = 3; 1342 1343 @SuppressWarnings("serial") 1344 private com.google.protobuf.LazyStringList missingIds_; 1345 /** 1346 * 1347 * 1348 * <pre> 1349 * IDs of products in the request that were missing from the inventory. 1350 * </pre> 1351 * 1352 * <code>repeated string missing_ids = 3;</code> 1353 * 1354 * @return A list containing the missingIds. 1355 */ getMissingIdsList()1356 public com.google.protobuf.ProtocolStringList getMissingIdsList() { 1357 return missingIds_; 1358 } 1359 /** 1360 * 1361 * 1362 * <pre> 1363 * IDs of products in the request that were missing from the inventory. 1364 * </pre> 1365 * 1366 * <code>repeated string missing_ids = 3;</code> 1367 * 1368 * @return The count of missingIds. 1369 */ getMissingIdsCount()1370 public int getMissingIdsCount() { 1371 return missingIds_.size(); 1372 } 1373 /** 1374 * 1375 * 1376 * <pre> 1377 * IDs of products in the request that were missing from the inventory. 1378 * </pre> 1379 * 1380 * <code>repeated string missing_ids = 3;</code> 1381 * 1382 * @param index The index of the element to return. 1383 * @return The missingIds at the given index. 1384 */ getMissingIds(int index)1385 public java.lang.String getMissingIds(int index) { 1386 return missingIds_.get(index); 1387 } 1388 /** 1389 * 1390 * 1391 * <pre> 1392 * IDs of products in the request that were missing from the inventory. 1393 * </pre> 1394 * 1395 * <code>repeated string missing_ids = 3;</code> 1396 * 1397 * @param index The index of the value to return. 1398 * @return The bytes of the missingIds at the given index. 1399 */ getMissingIdsBytes(int index)1400 public com.google.protobuf.ByteString getMissingIdsBytes(int index) { 1401 return missingIds_.getByteString(index); 1402 } 1403 1404 public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; 1405 private boolean validateOnly_ = false; 1406 /** 1407 * 1408 * 1409 * <pre> 1410 * True if the validateOnly property was set in the request. 1411 * </pre> 1412 * 1413 * <code>bool validate_only = 4;</code> 1414 * 1415 * @return The validateOnly. 1416 */ 1417 @java.lang.Override getValidateOnly()1418 public boolean getValidateOnly() { 1419 return validateOnly_; 1420 } 1421 1422 private byte memoizedIsInitialized = -1; 1423 1424 @java.lang.Override isInitialized()1425 public final boolean isInitialized() { 1426 byte isInitialized = memoizedIsInitialized; 1427 if (isInitialized == 1) return true; 1428 if (isInitialized == 0) return false; 1429 1430 memoizedIsInitialized = 1; 1431 return true; 1432 } 1433 1434 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)1435 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 1436 for (int i = 0; i < results_.size(); i++) { 1437 output.writeMessage(1, results_.get(i)); 1438 } 1439 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attributionToken_)) { 1440 com.google.protobuf.GeneratedMessageV3.writeString(output, 2, attributionToken_); 1441 } 1442 for (int i = 0; i < missingIds_.size(); i++) { 1443 com.google.protobuf.GeneratedMessageV3.writeString(output, 3, missingIds_.getRaw(i)); 1444 } 1445 if (validateOnly_ != false) { 1446 output.writeBool(4, validateOnly_); 1447 } 1448 getUnknownFields().writeTo(output); 1449 } 1450 1451 @java.lang.Override getSerializedSize()1452 public int getSerializedSize() { 1453 int size = memoizedSize; 1454 if (size != -1) return size; 1455 1456 size = 0; 1457 for (int i = 0; i < results_.size(); i++) { 1458 size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, results_.get(i)); 1459 } 1460 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(attributionToken_)) { 1461 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, attributionToken_); 1462 } 1463 { 1464 int dataSize = 0; 1465 for (int i = 0; i < missingIds_.size(); i++) { 1466 dataSize += computeStringSizeNoTag(missingIds_.getRaw(i)); 1467 } 1468 size += dataSize; 1469 size += 1 * getMissingIdsList().size(); 1470 } 1471 if (validateOnly_ != false) { 1472 size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); 1473 } 1474 size += getUnknownFields().getSerializedSize(); 1475 memoizedSize = size; 1476 return size; 1477 } 1478 1479 @java.lang.Override equals(final java.lang.Object obj)1480 public boolean equals(final java.lang.Object obj) { 1481 if (obj == this) { 1482 return true; 1483 } 1484 if (!(obj instanceof com.google.cloud.retail.v2.PredictResponse)) { 1485 return super.equals(obj); 1486 } 1487 com.google.cloud.retail.v2.PredictResponse other = 1488 (com.google.cloud.retail.v2.PredictResponse) obj; 1489 1490 if (!getResultsList().equals(other.getResultsList())) return false; 1491 if (!getAttributionToken().equals(other.getAttributionToken())) return false; 1492 if (!getMissingIdsList().equals(other.getMissingIdsList())) return false; 1493 if (getValidateOnly() != other.getValidateOnly()) return false; 1494 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 1495 return true; 1496 } 1497 1498 @java.lang.Override hashCode()1499 public int hashCode() { 1500 if (memoizedHashCode != 0) { 1501 return memoizedHashCode; 1502 } 1503 int hash = 41; 1504 hash = (19 * hash) + getDescriptor().hashCode(); 1505 if (getResultsCount() > 0) { 1506 hash = (37 * hash) + RESULTS_FIELD_NUMBER; 1507 hash = (53 * hash) + getResultsList().hashCode(); 1508 } 1509 hash = (37 * hash) + ATTRIBUTION_TOKEN_FIELD_NUMBER; 1510 hash = (53 * hash) + getAttributionToken().hashCode(); 1511 if (getMissingIdsCount() > 0) { 1512 hash = (37 * hash) + MISSING_IDS_FIELD_NUMBER; 1513 hash = (53 * hash) + getMissingIdsList().hashCode(); 1514 } 1515 hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; 1516 hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); 1517 hash = (29 * hash) + getUnknownFields().hashCode(); 1518 memoizedHashCode = hash; 1519 return hash; 1520 } 1521 parseFrom(java.nio.ByteBuffer data)1522 public static com.google.cloud.retail.v2.PredictResponse parseFrom(java.nio.ByteBuffer data) 1523 throws com.google.protobuf.InvalidProtocolBufferException { 1524 return PARSER.parseFrom(data); 1525 } 1526 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1527 public static com.google.cloud.retail.v2.PredictResponse parseFrom( 1528 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1529 throws com.google.protobuf.InvalidProtocolBufferException { 1530 return PARSER.parseFrom(data, extensionRegistry); 1531 } 1532 parseFrom( com.google.protobuf.ByteString data)1533 public static com.google.cloud.retail.v2.PredictResponse parseFrom( 1534 com.google.protobuf.ByteString data) 1535 throws com.google.protobuf.InvalidProtocolBufferException { 1536 return PARSER.parseFrom(data); 1537 } 1538 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1539 public static com.google.cloud.retail.v2.PredictResponse parseFrom( 1540 com.google.protobuf.ByteString data, 1541 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1542 throws com.google.protobuf.InvalidProtocolBufferException { 1543 return PARSER.parseFrom(data, extensionRegistry); 1544 } 1545 parseFrom(byte[] data)1546 public static com.google.cloud.retail.v2.PredictResponse parseFrom(byte[] data) 1547 throws com.google.protobuf.InvalidProtocolBufferException { 1548 return PARSER.parseFrom(data); 1549 } 1550 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1551 public static com.google.cloud.retail.v2.PredictResponse parseFrom( 1552 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1553 throws com.google.protobuf.InvalidProtocolBufferException { 1554 return PARSER.parseFrom(data, extensionRegistry); 1555 } 1556 parseFrom(java.io.InputStream input)1557 public static com.google.cloud.retail.v2.PredictResponse parseFrom(java.io.InputStream input) 1558 throws java.io.IOException { 1559 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 1560 } 1561 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1562 public static com.google.cloud.retail.v2.PredictResponse parseFrom( 1563 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1564 throws java.io.IOException { 1565 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 1566 PARSER, input, extensionRegistry); 1567 } 1568 parseDelimitedFrom( java.io.InputStream input)1569 public static com.google.cloud.retail.v2.PredictResponse parseDelimitedFrom( 1570 java.io.InputStream input) throws java.io.IOException { 1571 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 1572 } 1573 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1574 public static com.google.cloud.retail.v2.PredictResponse parseDelimitedFrom( 1575 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1576 throws java.io.IOException { 1577 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 1578 PARSER, input, extensionRegistry); 1579 } 1580 parseFrom( com.google.protobuf.CodedInputStream input)1581 public static com.google.cloud.retail.v2.PredictResponse parseFrom( 1582 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 1583 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 1584 } 1585 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1586 public static com.google.cloud.retail.v2.PredictResponse parseFrom( 1587 com.google.protobuf.CodedInputStream input, 1588 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1589 throws java.io.IOException { 1590 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 1591 PARSER, input, extensionRegistry); 1592 } 1593 1594 @java.lang.Override newBuilderForType()1595 public Builder newBuilderForType() { 1596 return newBuilder(); 1597 } 1598 newBuilder()1599 public static Builder newBuilder() { 1600 return DEFAULT_INSTANCE.toBuilder(); 1601 } 1602 newBuilder(com.google.cloud.retail.v2.PredictResponse prototype)1603 public static Builder newBuilder(com.google.cloud.retail.v2.PredictResponse prototype) { 1604 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 1605 } 1606 1607 @java.lang.Override toBuilder()1608 public Builder toBuilder() { 1609 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 1610 } 1611 1612 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)1613 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1614 Builder builder = new Builder(parent); 1615 return builder; 1616 } 1617 /** 1618 * 1619 * 1620 * <pre> 1621 * Response message for predict method. 1622 * </pre> 1623 * 1624 * Protobuf type {@code google.cloud.retail.v2.PredictResponse} 1625 */ 1626 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 1627 implements 1628 // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PredictResponse) 1629 com.google.cloud.retail.v2.PredictResponseOrBuilder { getDescriptor()1630 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 1631 return com.google.cloud.retail.v2.PredictionServiceProto 1632 .internal_static_google_cloud_retail_v2_PredictResponse_descriptor; 1633 } 1634 1635 @java.lang.Override 1636 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()1637 internalGetFieldAccessorTable() { 1638 return com.google.cloud.retail.v2.PredictionServiceProto 1639 .internal_static_google_cloud_retail_v2_PredictResponse_fieldAccessorTable 1640 .ensureFieldAccessorsInitialized( 1641 com.google.cloud.retail.v2.PredictResponse.class, 1642 com.google.cloud.retail.v2.PredictResponse.Builder.class); 1643 } 1644 1645 // Construct using com.google.cloud.retail.v2.PredictResponse.newBuilder() Builder()1646 private Builder() {} 1647 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)1648 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1649 super(parent); 1650 } 1651 1652 @java.lang.Override clear()1653 public Builder clear() { 1654 super.clear(); 1655 bitField0_ = 0; 1656 if (resultsBuilder_ == null) { 1657 results_ = java.util.Collections.emptyList(); 1658 } else { 1659 results_ = null; 1660 resultsBuilder_.clear(); 1661 } 1662 bitField0_ = (bitField0_ & ~0x00000001); 1663 attributionToken_ = ""; 1664 missingIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; 1665 bitField0_ = (bitField0_ & ~0x00000004); 1666 validateOnly_ = false; 1667 return this; 1668 } 1669 1670 @java.lang.Override getDescriptorForType()1671 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 1672 return com.google.cloud.retail.v2.PredictionServiceProto 1673 .internal_static_google_cloud_retail_v2_PredictResponse_descriptor; 1674 } 1675 1676 @java.lang.Override getDefaultInstanceForType()1677 public com.google.cloud.retail.v2.PredictResponse getDefaultInstanceForType() { 1678 return com.google.cloud.retail.v2.PredictResponse.getDefaultInstance(); 1679 } 1680 1681 @java.lang.Override build()1682 public com.google.cloud.retail.v2.PredictResponse build() { 1683 com.google.cloud.retail.v2.PredictResponse result = buildPartial(); 1684 if (!result.isInitialized()) { 1685 throw newUninitializedMessageException(result); 1686 } 1687 return result; 1688 } 1689 1690 @java.lang.Override buildPartial()1691 public com.google.cloud.retail.v2.PredictResponse buildPartial() { 1692 com.google.cloud.retail.v2.PredictResponse result = 1693 new com.google.cloud.retail.v2.PredictResponse(this); 1694 buildPartialRepeatedFields(result); 1695 if (bitField0_ != 0) { 1696 buildPartial0(result); 1697 } 1698 onBuilt(); 1699 return result; 1700 } 1701 buildPartialRepeatedFields(com.google.cloud.retail.v2.PredictResponse result)1702 private void buildPartialRepeatedFields(com.google.cloud.retail.v2.PredictResponse result) { 1703 if (resultsBuilder_ == null) { 1704 if (((bitField0_ & 0x00000001) != 0)) { 1705 results_ = java.util.Collections.unmodifiableList(results_); 1706 bitField0_ = (bitField0_ & ~0x00000001); 1707 } 1708 result.results_ = results_; 1709 } else { 1710 result.results_ = resultsBuilder_.build(); 1711 } 1712 if (((bitField0_ & 0x00000004) != 0)) { 1713 missingIds_ = missingIds_.getUnmodifiableView(); 1714 bitField0_ = (bitField0_ & ~0x00000004); 1715 } 1716 result.missingIds_ = missingIds_; 1717 } 1718 buildPartial0(com.google.cloud.retail.v2.PredictResponse result)1719 private void buildPartial0(com.google.cloud.retail.v2.PredictResponse result) { 1720 int from_bitField0_ = bitField0_; 1721 if (((from_bitField0_ & 0x00000002) != 0)) { 1722 result.attributionToken_ = attributionToken_; 1723 } 1724 if (((from_bitField0_ & 0x00000008) != 0)) { 1725 result.validateOnly_ = validateOnly_; 1726 } 1727 } 1728 1729 @java.lang.Override clone()1730 public Builder clone() { 1731 return super.clone(); 1732 } 1733 1734 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)1735 public Builder setField( 1736 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 1737 return super.setField(field, value); 1738 } 1739 1740 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)1741 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 1742 return super.clearField(field); 1743 } 1744 1745 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)1746 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 1747 return super.clearOneof(oneof); 1748 } 1749 1750 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)1751 public Builder setRepeatedField( 1752 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 1753 return super.setRepeatedField(field, index, value); 1754 } 1755 1756 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)1757 public Builder addRepeatedField( 1758 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 1759 return super.addRepeatedField(field, value); 1760 } 1761 1762 @java.lang.Override mergeFrom(com.google.protobuf.Message other)1763 public Builder mergeFrom(com.google.protobuf.Message other) { 1764 if (other instanceof com.google.cloud.retail.v2.PredictResponse) { 1765 return mergeFrom((com.google.cloud.retail.v2.PredictResponse) other); 1766 } else { 1767 super.mergeFrom(other); 1768 return this; 1769 } 1770 } 1771 mergeFrom(com.google.cloud.retail.v2.PredictResponse other)1772 public Builder mergeFrom(com.google.cloud.retail.v2.PredictResponse other) { 1773 if (other == com.google.cloud.retail.v2.PredictResponse.getDefaultInstance()) return this; 1774 if (resultsBuilder_ == null) { 1775 if (!other.results_.isEmpty()) { 1776 if (results_.isEmpty()) { 1777 results_ = other.results_; 1778 bitField0_ = (bitField0_ & ~0x00000001); 1779 } else { 1780 ensureResultsIsMutable(); 1781 results_.addAll(other.results_); 1782 } 1783 onChanged(); 1784 } 1785 } else { 1786 if (!other.results_.isEmpty()) { 1787 if (resultsBuilder_.isEmpty()) { 1788 resultsBuilder_.dispose(); 1789 resultsBuilder_ = null; 1790 results_ = other.results_; 1791 bitField0_ = (bitField0_ & ~0x00000001); 1792 resultsBuilder_ = 1793 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 1794 ? getResultsFieldBuilder() 1795 : null; 1796 } else { 1797 resultsBuilder_.addAllMessages(other.results_); 1798 } 1799 } 1800 } 1801 if (!other.getAttributionToken().isEmpty()) { 1802 attributionToken_ = other.attributionToken_; 1803 bitField0_ |= 0x00000002; 1804 onChanged(); 1805 } 1806 if (!other.missingIds_.isEmpty()) { 1807 if (missingIds_.isEmpty()) { 1808 missingIds_ = other.missingIds_; 1809 bitField0_ = (bitField0_ & ~0x00000004); 1810 } else { 1811 ensureMissingIdsIsMutable(); 1812 missingIds_.addAll(other.missingIds_); 1813 } 1814 onChanged(); 1815 } 1816 if (other.getValidateOnly() != false) { 1817 setValidateOnly(other.getValidateOnly()); 1818 } 1819 this.mergeUnknownFields(other.getUnknownFields()); 1820 onChanged(); 1821 return this; 1822 } 1823 1824 @java.lang.Override isInitialized()1825 public final boolean isInitialized() { 1826 return true; 1827 } 1828 1829 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1830 public Builder mergeFrom( 1831 com.google.protobuf.CodedInputStream input, 1832 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1833 throws java.io.IOException { 1834 if (extensionRegistry == null) { 1835 throw new java.lang.NullPointerException(); 1836 } 1837 try { 1838 boolean done = false; 1839 while (!done) { 1840 int tag = input.readTag(); 1841 switch (tag) { 1842 case 0: 1843 done = true; 1844 break; 1845 case 10: 1846 { 1847 com.google.cloud.retail.v2.PredictResponse.PredictionResult m = 1848 input.readMessage( 1849 com.google.cloud.retail.v2.PredictResponse.PredictionResult.parser(), 1850 extensionRegistry); 1851 if (resultsBuilder_ == null) { 1852 ensureResultsIsMutable(); 1853 results_.add(m); 1854 } else { 1855 resultsBuilder_.addMessage(m); 1856 } 1857 break; 1858 } // case 10 1859 case 18: 1860 { 1861 attributionToken_ = input.readStringRequireUtf8(); 1862 bitField0_ |= 0x00000002; 1863 break; 1864 } // case 18 1865 case 26: 1866 { 1867 java.lang.String s = input.readStringRequireUtf8(); 1868 ensureMissingIdsIsMutable(); 1869 missingIds_.add(s); 1870 break; 1871 } // case 26 1872 case 32: 1873 { 1874 validateOnly_ = input.readBool(); 1875 bitField0_ |= 0x00000008; 1876 break; 1877 } // case 32 1878 default: 1879 { 1880 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 1881 done = true; // was an endgroup tag 1882 } 1883 break; 1884 } // default: 1885 } // switch (tag) 1886 } // while (!done) 1887 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1888 throw e.unwrapIOException(); 1889 } finally { 1890 onChanged(); 1891 } // finally 1892 return this; 1893 } 1894 1895 private int bitField0_; 1896 1897 private java.util.List<com.google.cloud.retail.v2.PredictResponse.PredictionResult> results_ = 1898 java.util.Collections.emptyList(); 1899 ensureResultsIsMutable()1900 private void ensureResultsIsMutable() { 1901 if (!((bitField0_ & 0x00000001) != 0)) { 1902 results_ = 1903 new java.util.ArrayList<com.google.cloud.retail.v2.PredictResponse.PredictionResult>( 1904 results_); 1905 bitField0_ |= 0x00000001; 1906 } 1907 } 1908 1909 private com.google.protobuf.RepeatedFieldBuilderV3< 1910 com.google.cloud.retail.v2.PredictResponse.PredictionResult, 1911 com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder, 1912 com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder> 1913 resultsBuilder_; 1914 1915 /** 1916 * 1917 * 1918 * <pre> 1919 * A list of recommended products. The order represents the ranking (from the 1920 * most relevant product to the least). 1921 * </pre> 1922 * 1923 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1924 */ 1925 public java.util.List<com.google.cloud.retail.v2.PredictResponse.PredictionResult> getResultsList()1926 getResultsList() { 1927 if (resultsBuilder_ == null) { 1928 return java.util.Collections.unmodifiableList(results_); 1929 } else { 1930 return resultsBuilder_.getMessageList(); 1931 } 1932 } 1933 /** 1934 * 1935 * 1936 * <pre> 1937 * A list of recommended products. The order represents the ranking (from the 1938 * most relevant product to the least). 1939 * </pre> 1940 * 1941 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1942 */ getResultsCount()1943 public int getResultsCount() { 1944 if (resultsBuilder_ == null) { 1945 return results_.size(); 1946 } else { 1947 return resultsBuilder_.getCount(); 1948 } 1949 } 1950 /** 1951 * 1952 * 1953 * <pre> 1954 * A list of recommended products. The order represents the ranking (from the 1955 * most relevant product to the least). 1956 * </pre> 1957 * 1958 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1959 */ getResults(int index)1960 public com.google.cloud.retail.v2.PredictResponse.PredictionResult getResults(int index) { 1961 if (resultsBuilder_ == null) { 1962 return results_.get(index); 1963 } else { 1964 return resultsBuilder_.getMessage(index); 1965 } 1966 } 1967 /** 1968 * 1969 * 1970 * <pre> 1971 * A list of recommended products. The order represents the ranking (from the 1972 * most relevant product to the least). 1973 * </pre> 1974 * 1975 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 1976 */ setResults( int index, com.google.cloud.retail.v2.PredictResponse.PredictionResult value)1977 public Builder setResults( 1978 int index, com.google.cloud.retail.v2.PredictResponse.PredictionResult value) { 1979 if (resultsBuilder_ == null) { 1980 if (value == null) { 1981 throw new NullPointerException(); 1982 } 1983 ensureResultsIsMutable(); 1984 results_.set(index, value); 1985 onChanged(); 1986 } else { 1987 resultsBuilder_.setMessage(index, value); 1988 } 1989 return this; 1990 } 1991 /** 1992 * 1993 * 1994 * <pre> 1995 * A list of recommended products. The order represents the ranking (from the 1996 * most relevant product to the least). 1997 * </pre> 1998 * 1999 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2000 */ setResults( int index, com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue)2001 public Builder setResults( 2002 int index, 2003 com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue) { 2004 if (resultsBuilder_ == null) { 2005 ensureResultsIsMutable(); 2006 results_.set(index, builderForValue.build()); 2007 onChanged(); 2008 } else { 2009 resultsBuilder_.setMessage(index, builderForValue.build()); 2010 } 2011 return this; 2012 } 2013 /** 2014 * 2015 * 2016 * <pre> 2017 * A list of recommended products. The order represents the ranking (from the 2018 * most relevant product to the least). 2019 * </pre> 2020 * 2021 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2022 */ addResults(com.google.cloud.retail.v2.PredictResponse.PredictionResult value)2023 public Builder addResults(com.google.cloud.retail.v2.PredictResponse.PredictionResult value) { 2024 if (resultsBuilder_ == null) { 2025 if (value == null) { 2026 throw new NullPointerException(); 2027 } 2028 ensureResultsIsMutable(); 2029 results_.add(value); 2030 onChanged(); 2031 } else { 2032 resultsBuilder_.addMessage(value); 2033 } 2034 return this; 2035 } 2036 /** 2037 * 2038 * 2039 * <pre> 2040 * A list of recommended products. The order represents the ranking (from the 2041 * most relevant product to the least). 2042 * </pre> 2043 * 2044 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2045 */ addResults( int index, com.google.cloud.retail.v2.PredictResponse.PredictionResult value)2046 public Builder addResults( 2047 int index, com.google.cloud.retail.v2.PredictResponse.PredictionResult value) { 2048 if (resultsBuilder_ == null) { 2049 if (value == null) { 2050 throw new NullPointerException(); 2051 } 2052 ensureResultsIsMutable(); 2053 results_.add(index, value); 2054 onChanged(); 2055 } else { 2056 resultsBuilder_.addMessage(index, value); 2057 } 2058 return this; 2059 } 2060 /** 2061 * 2062 * 2063 * <pre> 2064 * A list of recommended products. The order represents the ranking (from the 2065 * most relevant product to the least). 2066 * </pre> 2067 * 2068 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2069 */ addResults( com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue)2070 public Builder addResults( 2071 com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue) { 2072 if (resultsBuilder_ == null) { 2073 ensureResultsIsMutable(); 2074 results_.add(builderForValue.build()); 2075 onChanged(); 2076 } else { 2077 resultsBuilder_.addMessage(builderForValue.build()); 2078 } 2079 return this; 2080 } 2081 /** 2082 * 2083 * 2084 * <pre> 2085 * A list of recommended products. The order represents the ranking (from the 2086 * most relevant product to the least). 2087 * </pre> 2088 * 2089 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2090 */ addResults( int index, com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue)2091 public Builder addResults( 2092 int index, 2093 com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder builderForValue) { 2094 if (resultsBuilder_ == null) { 2095 ensureResultsIsMutable(); 2096 results_.add(index, builderForValue.build()); 2097 onChanged(); 2098 } else { 2099 resultsBuilder_.addMessage(index, builderForValue.build()); 2100 } 2101 return this; 2102 } 2103 /** 2104 * 2105 * 2106 * <pre> 2107 * A list of recommended products. The order represents the ranking (from the 2108 * most relevant product to the least). 2109 * </pre> 2110 * 2111 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2112 */ addAllResults( java.lang.Iterable<? extends com.google.cloud.retail.v2.PredictResponse.PredictionResult> values)2113 public Builder addAllResults( 2114 java.lang.Iterable<? extends com.google.cloud.retail.v2.PredictResponse.PredictionResult> 2115 values) { 2116 if (resultsBuilder_ == null) { 2117 ensureResultsIsMutable(); 2118 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, results_); 2119 onChanged(); 2120 } else { 2121 resultsBuilder_.addAllMessages(values); 2122 } 2123 return this; 2124 } 2125 /** 2126 * 2127 * 2128 * <pre> 2129 * A list of recommended products. The order represents the ranking (from the 2130 * most relevant product to the least). 2131 * </pre> 2132 * 2133 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2134 */ clearResults()2135 public Builder clearResults() { 2136 if (resultsBuilder_ == null) { 2137 results_ = java.util.Collections.emptyList(); 2138 bitField0_ = (bitField0_ & ~0x00000001); 2139 onChanged(); 2140 } else { 2141 resultsBuilder_.clear(); 2142 } 2143 return this; 2144 } 2145 /** 2146 * 2147 * 2148 * <pre> 2149 * A list of recommended products. The order represents the ranking (from the 2150 * most relevant product to the least). 2151 * </pre> 2152 * 2153 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2154 */ removeResults(int index)2155 public Builder removeResults(int index) { 2156 if (resultsBuilder_ == null) { 2157 ensureResultsIsMutable(); 2158 results_.remove(index); 2159 onChanged(); 2160 } else { 2161 resultsBuilder_.remove(index); 2162 } 2163 return this; 2164 } 2165 /** 2166 * 2167 * 2168 * <pre> 2169 * A list of recommended products. The order represents the ranking (from the 2170 * most relevant product to the least). 2171 * </pre> 2172 * 2173 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2174 */ getResultsBuilder( int index)2175 public com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder getResultsBuilder( 2176 int index) { 2177 return getResultsFieldBuilder().getBuilder(index); 2178 } 2179 /** 2180 * 2181 * 2182 * <pre> 2183 * A list of recommended products. The order represents the ranking (from the 2184 * most relevant product to the least). 2185 * </pre> 2186 * 2187 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2188 */ getResultsOrBuilder( int index)2189 public com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder getResultsOrBuilder( 2190 int index) { 2191 if (resultsBuilder_ == null) { 2192 return results_.get(index); 2193 } else { 2194 return resultsBuilder_.getMessageOrBuilder(index); 2195 } 2196 } 2197 /** 2198 * 2199 * 2200 * <pre> 2201 * A list of recommended products. The order represents the ranking (from the 2202 * most relevant product to the least). 2203 * </pre> 2204 * 2205 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2206 */ 2207 public java.util.List< 2208 ? extends com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder> getResultsOrBuilderList()2209 getResultsOrBuilderList() { 2210 if (resultsBuilder_ != null) { 2211 return resultsBuilder_.getMessageOrBuilderList(); 2212 } else { 2213 return java.util.Collections.unmodifiableList(results_); 2214 } 2215 } 2216 /** 2217 * 2218 * 2219 * <pre> 2220 * A list of recommended products. The order represents the ranking (from the 2221 * most relevant product to the least). 2222 * </pre> 2223 * 2224 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2225 */ addResultsBuilder()2226 public com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder addResultsBuilder() { 2227 return getResultsFieldBuilder() 2228 .addBuilder( 2229 com.google.cloud.retail.v2.PredictResponse.PredictionResult.getDefaultInstance()); 2230 } 2231 /** 2232 * 2233 * 2234 * <pre> 2235 * A list of recommended products. The order represents the ranking (from the 2236 * most relevant product to the least). 2237 * </pre> 2238 * 2239 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2240 */ addResultsBuilder( int index)2241 public com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder addResultsBuilder( 2242 int index) { 2243 return getResultsFieldBuilder() 2244 .addBuilder( 2245 index, 2246 com.google.cloud.retail.v2.PredictResponse.PredictionResult.getDefaultInstance()); 2247 } 2248 /** 2249 * 2250 * 2251 * <pre> 2252 * A list of recommended products. The order represents the ranking (from the 2253 * most relevant product to the least). 2254 * </pre> 2255 * 2256 * <code>repeated .google.cloud.retail.v2.PredictResponse.PredictionResult results = 1;</code> 2257 */ 2258 public java.util.List<com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder> getResultsBuilderList()2259 getResultsBuilderList() { 2260 return getResultsFieldBuilder().getBuilderList(); 2261 } 2262 2263 private com.google.protobuf.RepeatedFieldBuilderV3< 2264 com.google.cloud.retail.v2.PredictResponse.PredictionResult, 2265 com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder, 2266 com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder> getResultsFieldBuilder()2267 getResultsFieldBuilder() { 2268 if (resultsBuilder_ == null) { 2269 resultsBuilder_ = 2270 new com.google.protobuf.RepeatedFieldBuilderV3< 2271 com.google.cloud.retail.v2.PredictResponse.PredictionResult, 2272 com.google.cloud.retail.v2.PredictResponse.PredictionResult.Builder, 2273 com.google.cloud.retail.v2.PredictResponse.PredictionResultOrBuilder>( 2274 results_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); 2275 results_ = null; 2276 } 2277 return resultsBuilder_; 2278 } 2279 2280 private java.lang.Object attributionToken_ = ""; 2281 /** 2282 * 2283 * 2284 * <pre> 2285 * A unique attribution token. This should be included in the 2286 * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this 2287 * recommendation, which enables accurate attribution of recommendation model 2288 * performance. 2289 * </pre> 2290 * 2291 * <code>string attribution_token = 2;</code> 2292 * 2293 * @return The attributionToken. 2294 */ getAttributionToken()2295 public java.lang.String getAttributionToken() { 2296 java.lang.Object ref = attributionToken_; 2297 if (!(ref instanceof java.lang.String)) { 2298 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 2299 java.lang.String s = bs.toStringUtf8(); 2300 attributionToken_ = s; 2301 return s; 2302 } else { 2303 return (java.lang.String) ref; 2304 } 2305 } 2306 /** 2307 * 2308 * 2309 * <pre> 2310 * A unique attribution token. This should be included in the 2311 * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this 2312 * recommendation, which enables accurate attribution of recommendation model 2313 * performance. 2314 * </pre> 2315 * 2316 * <code>string attribution_token = 2;</code> 2317 * 2318 * @return The bytes for attributionToken. 2319 */ getAttributionTokenBytes()2320 public com.google.protobuf.ByteString getAttributionTokenBytes() { 2321 java.lang.Object ref = attributionToken_; 2322 if (ref instanceof String) { 2323 com.google.protobuf.ByteString b = 2324 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 2325 attributionToken_ = b; 2326 return b; 2327 } else { 2328 return (com.google.protobuf.ByteString) ref; 2329 } 2330 } 2331 /** 2332 * 2333 * 2334 * <pre> 2335 * A unique attribution token. This should be included in the 2336 * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this 2337 * recommendation, which enables accurate attribution of recommendation model 2338 * performance. 2339 * </pre> 2340 * 2341 * <code>string attribution_token = 2;</code> 2342 * 2343 * @param value The attributionToken to set. 2344 * @return This builder for chaining. 2345 */ setAttributionToken(java.lang.String value)2346 public Builder setAttributionToken(java.lang.String value) { 2347 if (value == null) { 2348 throw new NullPointerException(); 2349 } 2350 attributionToken_ = value; 2351 bitField0_ |= 0x00000002; 2352 onChanged(); 2353 return this; 2354 } 2355 /** 2356 * 2357 * 2358 * <pre> 2359 * A unique attribution token. This should be included in the 2360 * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this 2361 * recommendation, which enables accurate attribution of recommendation model 2362 * performance. 2363 * </pre> 2364 * 2365 * <code>string attribution_token = 2;</code> 2366 * 2367 * @return This builder for chaining. 2368 */ clearAttributionToken()2369 public Builder clearAttributionToken() { 2370 attributionToken_ = getDefaultInstance().getAttributionToken(); 2371 bitField0_ = (bitField0_ & ~0x00000002); 2372 onChanged(); 2373 return this; 2374 } 2375 /** 2376 * 2377 * 2378 * <pre> 2379 * A unique attribution token. This should be included in the 2380 * [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this 2381 * recommendation, which enables accurate attribution of recommendation model 2382 * performance. 2383 * </pre> 2384 * 2385 * <code>string attribution_token = 2;</code> 2386 * 2387 * @param value The bytes for attributionToken to set. 2388 * @return This builder for chaining. 2389 */ setAttributionTokenBytes(com.google.protobuf.ByteString value)2390 public Builder setAttributionTokenBytes(com.google.protobuf.ByteString value) { 2391 if (value == null) { 2392 throw new NullPointerException(); 2393 } 2394 checkByteStringIsUtf8(value); 2395 attributionToken_ = value; 2396 bitField0_ |= 0x00000002; 2397 onChanged(); 2398 return this; 2399 } 2400 2401 private com.google.protobuf.LazyStringList missingIds_ = 2402 com.google.protobuf.LazyStringArrayList.EMPTY; 2403 ensureMissingIdsIsMutable()2404 private void ensureMissingIdsIsMutable() { 2405 if (!((bitField0_ & 0x00000004) != 0)) { 2406 missingIds_ = new com.google.protobuf.LazyStringArrayList(missingIds_); 2407 bitField0_ |= 0x00000004; 2408 } 2409 } 2410 /** 2411 * 2412 * 2413 * <pre> 2414 * IDs of products in the request that were missing from the inventory. 2415 * </pre> 2416 * 2417 * <code>repeated string missing_ids = 3;</code> 2418 * 2419 * @return A list containing the missingIds. 2420 */ getMissingIdsList()2421 public com.google.protobuf.ProtocolStringList getMissingIdsList() { 2422 return missingIds_.getUnmodifiableView(); 2423 } 2424 /** 2425 * 2426 * 2427 * <pre> 2428 * IDs of products in the request that were missing from the inventory. 2429 * </pre> 2430 * 2431 * <code>repeated string missing_ids = 3;</code> 2432 * 2433 * @return The count of missingIds. 2434 */ getMissingIdsCount()2435 public int getMissingIdsCount() { 2436 return missingIds_.size(); 2437 } 2438 /** 2439 * 2440 * 2441 * <pre> 2442 * IDs of products in the request that were missing from the inventory. 2443 * </pre> 2444 * 2445 * <code>repeated string missing_ids = 3;</code> 2446 * 2447 * @param index The index of the element to return. 2448 * @return The missingIds at the given index. 2449 */ getMissingIds(int index)2450 public java.lang.String getMissingIds(int index) { 2451 return missingIds_.get(index); 2452 } 2453 /** 2454 * 2455 * 2456 * <pre> 2457 * IDs of products in the request that were missing from the inventory. 2458 * </pre> 2459 * 2460 * <code>repeated string missing_ids = 3;</code> 2461 * 2462 * @param index The index of the value to return. 2463 * @return The bytes of the missingIds at the given index. 2464 */ getMissingIdsBytes(int index)2465 public com.google.protobuf.ByteString getMissingIdsBytes(int index) { 2466 return missingIds_.getByteString(index); 2467 } 2468 /** 2469 * 2470 * 2471 * <pre> 2472 * IDs of products in the request that were missing from the inventory. 2473 * </pre> 2474 * 2475 * <code>repeated string missing_ids = 3;</code> 2476 * 2477 * @param index The index to set the value at. 2478 * @param value The missingIds to set. 2479 * @return This builder for chaining. 2480 */ setMissingIds(int index, java.lang.String value)2481 public Builder setMissingIds(int index, java.lang.String value) { 2482 if (value == null) { 2483 throw new NullPointerException(); 2484 } 2485 ensureMissingIdsIsMutable(); 2486 missingIds_.set(index, value); 2487 onChanged(); 2488 return this; 2489 } 2490 /** 2491 * 2492 * 2493 * <pre> 2494 * IDs of products in the request that were missing from the inventory. 2495 * </pre> 2496 * 2497 * <code>repeated string missing_ids = 3;</code> 2498 * 2499 * @param value The missingIds to add. 2500 * @return This builder for chaining. 2501 */ addMissingIds(java.lang.String value)2502 public Builder addMissingIds(java.lang.String value) { 2503 if (value == null) { 2504 throw new NullPointerException(); 2505 } 2506 ensureMissingIdsIsMutable(); 2507 missingIds_.add(value); 2508 onChanged(); 2509 return this; 2510 } 2511 /** 2512 * 2513 * 2514 * <pre> 2515 * IDs of products in the request that were missing from the inventory. 2516 * </pre> 2517 * 2518 * <code>repeated string missing_ids = 3;</code> 2519 * 2520 * @param values The missingIds to add. 2521 * @return This builder for chaining. 2522 */ addAllMissingIds(java.lang.Iterable<java.lang.String> values)2523 public Builder addAllMissingIds(java.lang.Iterable<java.lang.String> values) { 2524 ensureMissingIdsIsMutable(); 2525 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, missingIds_); 2526 onChanged(); 2527 return this; 2528 } 2529 /** 2530 * 2531 * 2532 * <pre> 2533 * IDs of products in the request that were missing from the inventory. 2534 * </pre> 2535 * 2536 * <code>repeated string missing_ids = 3;</code> 2537 * 2538 * @return This builder for chaining. 2539 */ clearMissingIds()2540 public Builder clearMissingIds() { 2541 missingIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; 2542 bitField0_ = (bitField0_ & ~0x00000004); 2543 onChanged(); 2544 return this; 2545 } 2546 /** 2547 * 2548 * 2549 * <pre> 2550 * IDs of products in the request that were missing from the inventory. 2551 * </pre> 2552 * 2553 * <code>repeated string missing_ids = 3;</code> 2554 * 2555 * @param value The bytes of the missingIds to add. 2556 * @return This builder for chaining. 2557 */ addMissingIdsBytes(com.google.protobuf.ByteString value)2558 public Builder addMissingIdsBytes(com.google.protobuf.ByteString value) { 2559 if (value == null) { 2560 throw new NullPointerException(); 2561 } 2562 checkByteStringIsUtf8(value); 2563 ensureMissingIdsIsMutable(); 2564 missingIds_.add(value); 2565 onChanged(); 2566 return this; 2567 } 2568 2569 private boolean validateOnly_; 2570 /** 2571 * 2572 * 2573 * <pre> 2574 * True if the validateOnly property was set in the request. 2575 * </pre> 2576 * 2577 * <code>bool validate_only = 4;</code> 2578 * 2579 * @return The validateOnly. 2580 */ 2581 @java.lang.Override getValidateOnly()2582 public boolean getValidateOnly() { 2583 return validateOnly_; 2584 } 2585 /** 2586 * 2587 * 2588 * <pre> 2589 * True if the validateOnly property was set in the request. 2590 * </pre> 2591 * 2592 * <code>bool validate_only = 4;</code> 2593 * 2594 * @param value The validateOnly to set. 2595 * @return This builder for chaining. 2596 */ setValidateOnly(boolean value)2597 public Builder setValidateOnly(boolean value) { 2598 2599 validateOnly_ = value; 2600 bitField0_ |= 0x00000008; 2601 onChanged(); 2602 return this; 2603 } 2604 /** 2605 * 2606 * 2607 * <pre> 2608 * True if the validateOnly property was set in the request. 2609 * </pre> 2610 * 2611 * <code>bool validate_only = 4;</code> 2612 * 2613 * @return This builder for chaining. 2614 */ clearValidateOnly()2615 public Builder clearValidateOnly() { 2616 bitField0_ = (bitField0_ & ~0x00000008); 2617 validateOnly_ = false; 2618 onChanged(); 2619 return this; 2620 } 2621 2622 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)2623 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 2624 return super.setUnknownFields(unknownFields); 2625 } 2626 2627 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2628 public final Builder mergeUnknownFields( 2629 final com.google.protobuf.UnknownFieldSet unknownFields) { 2630 return super.mergeUnknownFields(unknownFields); 2631 } 2632 2633 // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PredictResponse) 2634 } 2635 2636 // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PredictResponse) 2637 private static final com.google.cloud.retail.v2.PredictResponse DEFAULT_INSTANCE; 2638 2639 static { 2640 DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PredictResponse(); 2641 } 2642 getDefaultInstance()2643 public static com.google.cloud.retail.v2.PredictResponse getDefaultInstance() { 2644 return DEFAULT_INSTANCE; 2645 } 2646 2647 private static final com.google.protobuf.Parser<PredictResponse> PARSER = 2648 new com.google.protobuf.AbstractParser<PredictResponse>() { 2649 @java.lang.Override 2650 public PredictResponse parsePartialFrom( 2651 com.google.protobuf.CodedInputStream input, 2652 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2653 throws com.google.protobuf.InvalidProtocolBufferException { 2654 Builder builder = newBuilder(); 2655 try { 2656 builder.mergeFrom(input, extensionRegistry); 2657 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2658 throw e.setUnfinishedMessage(builder.buildPartial()); 2659 } catch (com.google.protobuf.UninitializedMessageException e) { 2660 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 2661 } catch (java.io.IOException e) { 2662 throw new com.google.protobuf.InvalidProtocolBufferException(e) 2663 .setUnfinishedMessage(builder.buildPartial()); 2664 } 2665 return builder.buildPartial(); 2666 } 2667 }; 2668 parser()2669 public static com.google.protobuf.Parser<PredictResponse> parser() { 2670 return PARSER; 2671 } 2672 2673 @java.lang.Override getParserForType()2674 public com.google.protobuf.Parser<PredictResponse> getParserForType() { 2675 return PARSER; 2676 } 2677 2678 @java.lang.Override getDefaultInstanceForType()2679 public com.google.cloud.retail.v2.PredictResponse getDefaultInstanceForType() { 2680 return DEFAULT_INSTANCE; 2681 } 2682 } 2683