@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.spanner.admin.instance.v1.ListInstancesResponse)) { return super.equals(obj); } com.google.spanner.admin.instance.v1.ListInstancesResponse other = (com.google.spanner.admin.instance.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; }
/** * * * <pre> * `next_page_token` can be sent in a subsequent * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] call to fetch more * of the matching instances. * </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 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; }
@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(); mockInstanceAdmin.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); 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 = mockInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListInstancesRequest actualRequest = (ListInstancesRequest) actualRequests.get(0); Assert.assertEquals(parent, ProjectName.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.spanner.admin.instance.v1.ListInstancesResponse getDefaultInstanceForType() { return com.google.spanner.admin.instance.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.spanner.admin.instance.v1.ListInstancesResponse build() { com.google.spanner.admin.instance.v1.ListInstancesResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.spanner.admin.instance.v1.ListInstancesResponse buildPartial() { com.google.spanner.admin.instance.v1.ListInstancesResponse result = new com.google.spanner.admin.instance.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 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; }
@Override public Iterable<Instance> extractResources(ListInstancesResponse payload) { return payload.getInstancesList() != null ? payload.getInstancesList() : ImmutableList.<Instance>of(); } };
io.grpc.protobuf.ProtoUtils.marshaller( com.google.spanner.admin.instance.v1.ListInstancesResponse .getDefaultInstance())) .setSchemaDescriptor( new InstanceAdminMethodDescriptorSupplier("ListInstances"))
@Override public String extractNextToken(ListInstancesResponse 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 < 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; }
@java.lang.Override public com.google.spanner.admin.instance.v1.ListInstancesResponse build() { com.google.spanner.admin.instance.v1.ListInstancesResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.spanner.admin.instance.v1.ListInstancesResponse buildPartial() { com.google.spanner.admin.instance.v1.ListInstancesResponse result = new com.google.spanner.admin.instance.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; }
@Override public Paginated<Instance> listInstances( int pageSize, @Nullable String pageToken, @Nullable String filter) throws SpannerException { ListInstancesRequest.Builder requestBuilder = ListInstancesRequest.newBuilder().setParent(projectName).setPageSize(pageSize); if (pageToken != null) { requestBuilder.setPageToken(pageToken); } if (filter != null) { requestBuilder.setFilter(filter); } ListInstancesRequest request = requestBuilder.build(); GrpcCallContext context = newCallContext(null, projectName); ListInstancesResponse response = get(instanceAdminStub.listInstancesCallable().futureCall(request, context)); return new Paginated<>(response.getInstancesList(), response.getNextPageToken()); }
public Builder mergeFrom(com.google.spanner.admin.instance.v1.ListInstancesResponse other) { if (other == com.google.spanner.admin.instance.v1.ListInstancesResponse.getDefaultInstance()) return this; if (instancesBuilder_ == null) { if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; onChanged();