@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getDevicesCount() > 0) { hash = (37 * hash) + DEVICES_FIELD_NUMBER; hash = (53 * hash) + getDevicesList().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 devices that match the * request; this value should be passed in a new `ListDevicesRequest`. * </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.iot.v1.ListDevicesResponse)) { return super.equals(obj); } com.google.cloud.iot.v1.ListDevicesResponse other = (com.google.cloud.iot.v1.ListDevicesResponse) obj; boolean result = true; result = result && getDevicesList().equals(other.getDevicesList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
@Test @SuppressWarnings("all") public void listDevicesTest() { String nextPageToken = ""; Device devicesElement = Device.newBuilder().build(); List<Device> devices = Arrays.asList(devicesElement); ListDevicesResponse expectedResponse = ListDevicesResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllDevices(devices) .build(); mockDeviceManager.addResponse(expectedResponse); RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); ListDevicesPagedResponse pagedListResponse = client.listDevices(parent); List<Device> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getDevicesList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockDeviceManager.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListDevicesRequest actualRequest = (ListDevicesRequest) actualRequests.get(0); Assert.assertEquals(parent, RegistryName.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public Iterable<Device> extractResources(ListDevicesResponse payload) { return payload.getDevicesList() != null ? payload.getDevicesList() : ImmutableList.<Device>of(); } };
@java.lang.Override public com.google.cloud.iot.v1.ListDevicesResponse getDefaultInstanceForType() { return com.google.cloud.iot.v1.ListDevicesResponse.getDefaultInstance(); }
@Override public String extractNextToken(ListDevicesResponse payload) { return payload.getNextPageToken(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < devices_.size(); i++) { output.writeMessage(1, devices_.get(i)); } if (!getNextPageTokenBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); } unknownFields.writeTo(output); }
@java.lang.Override public com.google.cloud.iot.v1.ListDevicesResponse build() { com.google.cloud.iot.v1.ListDevicesResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.cloud.iot.v1.ListDevicesResponse buildPartial() { com.google.cloud.iot.v1.ListDevicesResponse result = new com.google.cloud.iot.v1.ListDevicesResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (devicesBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { devices_ = java.util.Collections.unmodifiableList(devices_); bitField0_ = (bitField0_ & ~0x00000001); } result.devices_ = devices_; } else { result.devices_ = devicesBuilder_.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.iot.v1.ListDevicesResponse)) { return super.equals(obj); } com.google.cloud.iot.v1.ListDevicesResponse other = (com.google.cloud.iot.v1.ListDevicesResponse) obj; boolean result = true; result = result && getDevicesList().equals(other.getDevicesList()); result = result && getNextPageToken().equals(other.getNextPageToken()); result = result && unknownFields.equals(other.unknownFields); return result; }
.setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.cloud.iot.v1.ListDevicesResponse.getDefaultInstance())) .setSchemaDescriptor(new DeviceManagerMethodDescriptorSupplier("ListDevices")) .build();
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < devices_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, devices_.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.iot.v1.ListDevicesResponse build() { com.google.cloud.iot.v1.ListDevicesResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
@java.lang.Override public com.google.cloud.iot.v1.ListDevicesResponse buildPartial() { com.google.cloud.iot.v1.ListDevicesResponse result = new com.google.cloud.iot.v1.ListDevicesResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (devicesBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { devices_ = java.util.Collections.unmodifiableList(devices_); bitField0_ = (bitField0_ & ~0x00000001); } result.devices_ = devices_; } else { result.devices_ = devicesBuilder_.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 (getDevicesCount() > 0) { hash = (37 * hash) + DEVICES_FIELD_NUMBER; hash = (53 * hash) + getDevicesList().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.iot.v1.ListDevicesResponse other) { if (other == com.google.cloud.iot.v1.ListDevicesResponse.getDefaultInstance()) return this; if (devicesBuilder_ == null) { if (!other.devices_.isEmpty()) { if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; onChanged();
@java.lang.Override public com.google.cloud.iot.v1.ListDevicesResponse getDefaultInstanceForType() { return com.google.cloud.iot.v1.ListDevicesResponse.getDefaultInstance(); }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }