@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getLogNamesCount() > 0) { hash = (37 * hash) + LOG_NAMES_FIELD_NUMBER; hash = (53 * hash) + getLogNamesList().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 there might be more results than those appearing in this response, then * `nextPageToken` is included. To get the next set of results, call this * method again using the value of `nextPageToken` as `pageToken`. * </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.logging.v2.ListLogsResponse)) { return super.equals(obj); } com.google.logging.v2.ListLogsResponse other = (com.google.logging.v2.ListLogsResponse) obj; boolean result = true; result = result && getLogNamesList().equals(other.getLogNamesList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNextPageTokenBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); } { int dataSize = 0; for (int i = 0; i < logNames_.size(); i++) { dataSize += computeStringSizeNoTag(logNames_.getRaw(i)); } size += dataSize; size += 1 * getLogNamesList().size(); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@Test @SuppressWarnings("all") public void listLogsTest() { String nextPageToken = ""; String logNamesElement = "logNamesElement-1079688374"; List<String> logNames = Arrays.asList(logNamesElement); ListLogsResponse expectedResponse = ListLogsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllLogNames(logNames) .build(); mockLoggingServiceV2.addResponse(expectedResponse); ParentName parent = ProjectName.of("[PROJECT]"); ListLogsPagedResponse pagedListResponse = client.listLogs(parent); List<String> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getLogNamesList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockLoggingServiceV2.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListLogsRequest actualRequest = (ListLogsRequest) actualRequests.get(0); Assert.assertEquals(parent, ParentNames.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public Iterable<String> extractResources(ListLogsResponse payload) { return payload.getLogNamesList() != null ? payload.getLogNamesList() : ImmutableList.<String>of(); } };
@java.lang.Override public com.google.logging.v2.ListLogsResponse getDefaultInstanceForType() { return com.google.logging.v2.ListLogsResponse.getDefaultInstance(); }
@Override public String extractNextToken(ListLogsResponse payload) { return payload.getNextPageToken(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNextPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); } for (int i = 0; i < logNames_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 3, logNames_.getRaw(i)); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.logging.v2.ListLogsResponse buildPartial() { com.google.logging.v2.ListLogsResponse result = new com.google.logging.v2.ListLogsResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { logNames_ = logNames_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000001); } result.logNames_ = logNames_; result.nextPageToken_ = nextPageToken_; result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@Override public Iterable<String> extractResources(ListLogsResponse payload) { return payload.getLogNamesList() != null ? payload.getLogNamesList() : ImmutableList.<String>of(); } };
.setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.ListLogsResponse.getDefaultInstance())) .setSchemaDescriptor(new LoggingServiceV2MethodDescriptorSupplier("ListLogs")) .build();
@Override public String extractNextToken(ListLogsResponse payload) { return payload.getNextPageToken(); }
public Builder mergeFrom(com.google.logging.v2.ListLogsResponse other) { if (other == com.google.logging.v2.ListLogsResponse.getDefaultInstance()) return this; if (!other.logNames_.isEmpty()) { if (logNames_.isEmpty()) { logNames_ = other.logNames_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureLogNamesIsMutable(); logNames_.addAll(other.logNames_); } onChanged(); } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
.setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.logging.v2.ListLogsResponse.getDefaultInstance())) .setSchemaDescriptor(new LoggingServiceV2MethodDescriptorSupplier("ListLogs")) .build();