@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getInstancesCount() > 0) { hash = (37 * hash) + INSTANCES_FIELD_NUMBER; hash = (53 * hash) + getInstancesList().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.redis.v1.ListInstancesResponse)) { return super.equals(obj); } com.google.cloud.redis.v1.ListInstancesResponse other = (com.google.cloud.redis.v1.ListInstancesResponse) obj; boolean result = true; result = result && getInstancesList().equals(other.getInstancesList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@Test @SuppressWarnings("all") public void listInstancesTest() { String nextPageToken = ""; Instance instancesElement = Instance.newBuilder().build(); List<Instance> instances = Arrays.asList(instancesElement); ListInstancesResponse expectedResponse = ListInstancesResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllInstances(instances) .build(); mockCloudRedis.addResponse(expectedResponse); LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); ListInstancesPagedResponse pagedListResponse = client.listInstances(parent); List<Instance> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getInstancesList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockCloudRedis.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListInstancesRequest actualRequest = (ListInstancesRequest) actualRequests.get(0); Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public Iterable<Instance> extractResources(ListInstancesResponse payload) { return payload.getInstancesList() != null ? payload.getInstancesList() : ImmutableList.<Instance>of(); } };
@java.lang.Override public com.google.cloud.redis.v1.ListInstancesResponse getDefaultInstanceForType() { return com.google.cloud.redis.v1.ListInstancesResponse.getDefaultInstance(); }
@Override public String extractNextToken(ListInstancesResponse payload) { return payload.getNextPageToken(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < instances_.size(); i++) { output.writeMessage(1, instances_.get(i)); } if (!getNextPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.cloud.redis.v1.ListInstancesResponse buildPartial() { com.google.cloud.redis.v1.ListInstancesResponse result = new com.google.cloud.redis.v1.ListInstancesResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (instancesBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { instances_ = java.util.Collections.unmodifiableList(instances_); bitField0_ = (bitField0_ & ~0x00000001); } result.instances_ = instances_; } else { result.instances_ = instancesBuilder_.build(); } result.nextPageToken_ = nextPageToken_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@java.lang.Override public com.google.cloud.redis.v1.ListInstancesResponse build() { com.google.cloud.redis.v1.ListInstancesResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
.setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.cloud.redis.v1.ListInstancesResponse.getDefaultInstance())) .setSchemaDescriptor(new CloudRedisMethodDescriptorSupplier("ListInstances")) .build();
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < instances_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, instances_.get(i)); } if (!getNextPageTokenBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
public Builder mergeFrom(com.google.cloud.redis.v1.ListInstancesResponse other) { if (other == com.google.cloud.redis.v1.ListInstancesResponse.getDefaultInstance()) return this; if (instancesBuilder_ == null) { if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; onChanged();