public Builder mergeFrom(com.google.cloud.iot.v1.GetDeviceRequest other) { if (other == com.google.cloud.iot.v1.GetDeviceRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (other.hasFieldMask()) { mergeFieldMask(other.getFieldMask()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public com.google.cloud.iot.v1.GetDeviceRequest buildPartial() { com.google.cloud.iot.v1.GetDeviceRequest result = new com.google.cloud.iot.v1.GetDeviceRequest(this); result.name_ = name_; if (fieldMaskBuilder_ == null) { result.fieldMask_ = fieldMask_; } else { result.fieldMask_ = fieldMaskBuilder_.build(); } onBuilt(); return result; }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (fieldMask_ != null) { output.writeMessage(2, getFieldMask()); } unknownFields.writeTo(output); }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.iot.v1.GetDeviceRequest)) { return super.equals(obj); } com.google.cloud.iot.v1.GetDeviceRequest other = (com.google.cloud.iot.v1.GetDeviceRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && (hasFieldMask() == other.hasFieldMask()); if (hasFieldMask()) { result = result && getFieldMask().equals(other.getFieldMask()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); if (hasFieldMask()) { hash = (37 * hash) + FIELD_MASK_FIELD_NUMBER; hash = (53 * hash) + getFieldMask().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * The name of the device. For example, * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@Override public Map<String, String> extract(GetDeviceRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("name", String.valueOf(request.getName())); return params.build(); } })
@java.lang.Override public com.google.cloud.iot.v1.GetDeviceRequest getDefaultInstanceForType() { return com.google.cloud.iot.v1.GetDeviceRequest.getDefaultInstance(); }
@java.lang.Override public com.google.cloud.iot.v1.GetDeviceRequest build() { com.google.cloud.iot.v1.GetDeviceRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
/** * * * <pre> * The fields of the `Device` resource to be returned in the response. If the * field mask is unset or empty, all fields are returned. * </pre> * * <code>.google.protobuf.FieldMask field_mask = 2;</code> */ public com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder() { return getFieldMask(); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); if (hasFieldMask()) { hash = (37 * hash) + FIELD_MASK_FIELD_NUMBER; hash = (53 * hash) + getFieldMask().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.iot.v1.GetDeviceRequest)) { return super.equals(obj); } com.google.cloud.iot.v1.GetDeviceRequest other = (com.google.cloud.iot.v1.GetDeviceRequest) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && (hasFieldMask() == other.hasFieldMask()); if (hasFieldMask()) { result = result && getFieldMask().equals(other.getFieldMask()); } result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * The name of the device. For example, * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@Test @SuppressWarnings("all") public void getDeviceTest() { String id = "id3355"; DeviceName name2 = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); long numId = 1034366860L; boolean blocked = true; Device expectedResponse = Device.newBuilder() .setId(id) .setName(name2.toString()) .setNumId(numId) .setBlocked(blocked) .build(); mockDeviceManager.addResponse(expectedResponse); DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); Device actualResponse = client.getDevice(name); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockDeviceManager.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetDeviceRequest actualRequest = (GetDeviceRequest) actualRequests.get(0); Assert.assertEquals(name, DeviceName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (fieldMask_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getFieldMask()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.cloud.iot.v1.GetDeviceRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@java.lang.Override public com.google.cloud.iot.v1.GetDeviceRequest build() { com.google.cloud.iot.v1.GetDeviceRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
/** * * * <pre> * The fields of the `Device` resource to be returned in the response. If the * field mask is unset or empty, all fields are returned. * </pre> * * <code>.google.protobuf.FieldMask field_mask = 2;</code> */ public com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder() { return getFieldMask(); }
public Builder mergeFrom(com.google.cloud.iot.v1.GetDeviceRequest other) { if (other == com.google.cloud.iot.v1.GetDeviceRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (other.hasFieldMask()) { mergeFieldMask(other.getFieldMask()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }