@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getProductsCount() > 0) { hash = (37 * hash) + PRODUCTS_FIELD_NUMBER; hash = (53 * hash) + getProductsList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * Token to retrieve the next page of results, or empty if there are no more * results in the list. * </pre> * * <code>string next_page_token = 2;</code> */ public Builder clearNextPageToken() { nextPageToken_ = getDefaultInstance().getNextPageToken(); onChanged(); return this; } /**
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.vision.v1.ListProductsResponse)) { return super.equals(obj); } com.google.cloud.vision.v1.ListProductsResponse other = (com.google.cloud.vision.v1.ListProductsResponse) obj; boolean result = true; result = result && getProductsList().equals(other.getProductsList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@Test @SuppressWarnings("all") public void listProductsTest() { String nextPageToken = ""; Product productsElement = Product.newBuilder().build(); List<Product> products = Arrays.asList(productsElement); ListProductsResponse expectedResponse = ListProductsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllProducts(products) .build(); mockProductSearch.addResponse(expectedResponse); String formattedParent = ProductSearchClient.formatLocationName("[PROJECT]", "[LOCATION]"); ListProductsPagedResponse pagedListResponse = client.listProducts(formattedParent); List<Product> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getProductsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockProductSearch.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListProductsRequest actualRequest = (ListProductsRequest) actualRequests.get(0); Assert.assertEquals(formattedParent, actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public Iterable<Product> extractResources(ListProductsResponse payload) { return payload.getProductsList(); } };
@java.lang.Override public com.google.cloud.vision.v1.ListProductsResponse getDefaultInstanceForType() { return com.google.cloud.vision.v1.ListProductsResponse.getDefaultInstance(); }
@Override public String extractNextToken(ListProductsResponse payload) { return payload.getNextPageToken(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < products_.size(); i++) { output.writeMessage(1, products_.get(i)); } if (!getNextPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.cloud.vision.v1.ListProductsResponse build() { com.google.cloud.vision.v1.ListProductsResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.cloud.vision.v1.ListProductsResponse buildPartial() { com.google.cloud.vision.v1.ListProductsResponse result = new com.google.cloud.vision.v1.ListProductsResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (productsBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { products_ = java.util.Collections.unmodifiableList(products_); bitField0_ = (bitField0_ & ~0x00000001); } result.products_ = products_; } else { result.products_ = productsBuilder_.build(); } result.nextPageToken_ = nextPageToken_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.vision.v1.ListProductsResponse)) { return super.equals(obj); } com.google.cloud.vision.v1.ListProductsResponse other = (com.google.cloud.vision.v1.ListProductsResponse) obj; boolean result = true; result = result && getProductsList().equals(other.getProductsList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@Override public Iterable<Product> extractResources(ListProductsResponse payload) { return payload.getProductsList(); } };
.setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.cloud.vision.v1.ListProductsResponse.getDefaultInstance())) .setSchemaDescriptor( new ProductSearchMethodDescriptorSupplier("ListProducts"))
@Override public String extractNextToken(ListProductsResponse payload) { return payload.getNextPageToken(); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < products_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, products_.get(i)); } if (!getNextPageTokenBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public com.google.cloud.vision.v1.ListProductsResponse build() { com.google.cloud.vision.v1.ListProductsResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.cloud.vision.v1.ListProductsResponse buildPartial() { com.google.cloud.vision.v1.ListProductsResponse result = new com.google.cloud.vision.v1.ListProductsResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (productsBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { products_ = java.util.Collections.unmodifiableList(products_); bitField0_ = (bitField0_ & ~0x00000001); } result.products_ = products_; } else { result.products_ = productsBuilder_.build(); } result.nextPageToken_ = nextPageToken_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getProductsCount() > 0) { hash = (37 * hash) + PRODUCTS_FIELD_NUMBER; hash = (53 * hash) + getProductsList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.cloud.vision.v1.ListProductsResponse other) { if (other == com.google.cloud.vision.v1.ListProductsResponse.getDefaultInstance()) return this; if (productsBuilder_ == null) { if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; onChanged();