@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getSnapshotsCount() > 0) { hash = (37 * hash) + SNAPSHOTS_FIELD_NUMBER; hash = (53 * hash) + getSnapshotsList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * If not empty, indicates that there may be more snapshot that match the * request; this value should be passed in a new `ListSnapshotsRequest`. * </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.pubsub.v1.ListSnapshotsResponse)) { return super.equals(obj); } com.google.pubsub.v1.ListSnapshotsResponse other = (com.google.pubsub.v1.ListSnapshotsResponse) obj; boolean result = true; result = result && getSnapshotsList().equals(other.getSnapshotsList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@Test @SuppressWarnings("all") public void listSnapshotsTest() { String nextPageToken = ""; Snapshot snapshotsElement = Snapshot.newBuilder().build(); List<Snapshot> snapshots = Arrays.asList(snapshotsElement); ListSnapshotsResponse expectedResponse = ListSnapshotsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllSnapshots(snapshots) .build(); mockSubscriber.addResponse(expectedResponse); ProjectName project = ProjectName.of("[PROJECT]"); ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(project); List<Snapshot> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListSnapshotsRequest actualRequest = (ListSnapshotsRequest) actualRequests.get(0); Assert.assertEquals(project, ProjectName.parse(actualRequest.getProject())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public Iterable<Snapshot> extractResources(ListSnapshotsResponse payload) { return payload.getSnapshotsList() != null ? payload.getSnapshotsList() : ImmutableList.<Snapshot>of(); } };
@java.lang.Override public com.google.pubsub.v1.ListSnapshotsResponse getDefaultInstanceForType() { return com.google.pubsub.v1.ListSnapshotsResponse.getDefaultInstance(); }
@Override public String extractNextToken(ListSnapshotsResponse payload) { return payload.getNextPageToken(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < snapshots_.size(); i++) { output.writeMessage(1, snapshots_.get(i)); } if (!getNextPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.pubsub.v1.ListSnapshotsResponse build() { com.google.pubsub.v1.ListSnapshotsResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.pubsub.v1.ListSnapshotsResponse buildPartial() { com.google.pubsub.v1.ListSnapshotsResponse result = new com.google.pubsub.v1.ListSnapshotsResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (snapshotsBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { snapshots_ = java.util.Collections.unmodifiableList(snapshots_); bitField0_ = (bitField0_ & ~0x00000001); } result.snapshots_ = snapshots_; } else { result.snapshots_ = snapshotsBuilder_.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.pubsub.v1.ListSnapshotsResponse)) { return super.equals(obj); } com.google.pubsub.v1.ListSnapshotsResponse other = (com.google.pubsub.v1.ListSnapshotsResponse) obj; boolean result = true; result = result && getSnapshotsList().equals(other.getSnapshotsList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
.setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.pubsub.v1.ListSnapshotsResponse.getDefaultInstance())) .setSchemaDescriptor(new SubscriberMethodDescriptorSupplier("ListSnapshots")) .build();
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < snapshots_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, snapshots_.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.pubsub.v1.ListSnapshotsResponse build() { com.google.pubsub.v1.ListSnapshotsResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.pubsub.v1.ListSnapshotsResponse buildPartial() { com.google.pubsub.v1.ListSnapshotsResponse result = new com.google.pubsub.v1.ListSnapshotsResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (snapshotsBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { snapshots_ = java.util.Collections.unmodifiableList(snapshots_); bitField0_ = (bitField0_ & ~0x00000001); } result.snapshots_ = snapshots_; } else { result.snapshots_ = snapshotsBuilder_.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 (getSnapshotsCount() > 0) { hash = (37 * hash) + SNAPSHOTS_FIELD_NUMBER; hash = (53 * hash) + getSnapshotsList().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.pubsub.v1.ListSnapshotsResponse other) { if (other == com.google.pubsub.v1.ListSnapshotsResponse.getDefaultInstance()) return this; if (snapshotsBuilder_ == null) { if (!other.snapshots_.isEmpty()) { if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; onChanged();
@java.lang.Override public com.google.pubsub.v1.ListSnapshotsResponse getDefaultInstanceForType() { return com.google.pubsub.v1.ListSnapshotsResponse.getDefaultInstance(); }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }