/** * * * <pre> * The fields to update. * None of the field paths in the mask may contain a reserved name. * If the document exists on the server and has fields not referenced in the * mask, they are left unchanged. * Fields referenced in the mask, but not present in the input document, are * deleted from the document on the server. * </pre> * * <code>.google.firestore.v1beta1.DocumentMask update_mask = 2;</code> */ public com.google.firestore.v1beta1.DocumentMaskOrBuilder getUpdateMaskOrBuilder() { return getUpdateMask(); }
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (document_ != null) { output.writeMessage(1, getDocument()); } if (updateMask_ != null) { output.writeMessage(2, getUpdateMask()); } if (mask_ != null) { output.writeMessage(3, getMask()); } if (currentDocument_ != null) { output.writeMessage(4, getCurrentDocument()); } unknownFields.writeTo(output); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (document_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); } if (updateMask_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); } if (mask_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getMask()); } if (currentDocument_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getCurrentDocument()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasDocument()) { hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; hash = (53 * hash) + getDocument().hashCode(); } if (hasUpdateMask()) { hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; hash = (53 * hash) + getUpdateMask().hashCode(); } if (hasMask()) { hash = (37 * hash) + MASK_FIELD_NUMBER; hash = (53 * hash) + getMask().hashCode(); } if (hasCurrentDocument()) { hash = (37 * hash) + CURRENT_DOCUMENT_FIELD_NUMBER; hash = (53 * hash) + getCurrentDocument().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.firestore.v1beta1.UpdateDocumentRequest)) { return super.equals(obj); } com.google.firestore.v1beta1.UpdateDocumentRequest other = (com.google.firestore.v1beta1.UpdateDocumentRequest) obj; boolean result = true; result = result && (hasDocument() == other.hasDocument()); if (hasDocument()) { result = result && getDocument().equals(other.getDocument()); } result = result && (hasUpdateMask() == other.hasUpdateMask()); if (hasUpdateMask()) { result = result && getUpdateMask().equals(other.getUpdateMask()); } result = result && (hasMask() == other.hasMask()); if (hasMask()) { result = result && getMask().equals(other.getMask()); } result = result && (hasCurrentDocument() == other.hasCurrentDocument()); if (hasCurrentDocument()) { result = result && getCurrentDocument().equals(other.getCurrentDocument()); } result = result && unknownFields.equals(other.unknownFields); return result; }
public Builder mergeFrom(com.google.firestore.v1beta1.UpdateDocumentRequest other) { if (other == com.google.firestore.v1beta1.UpdateDocumentRequest.getDefaultInstance()) return this; if (other.hasDocument()) { mergeDocument(other.getDocument()); } if (other.hasUpdateMask()) { mergeUpdateMask(other.getUpdateMask()); } if (other.hasMask()) { mergeMask(other.getMask()); } if (other.hasCurrentDocument()) { mergeCurrentDocument(other.getCurrentDocument()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void updateDocumentTest() { String name = "name3373707"; Document expectedResponse = Document.newBuilder().setName(name).build(); mockFirestore.addResponse(expectedResponse); Document document = Document.newBuilder().build(); DocumentMask updateMask = DocumentMask.newBuilder().build(); Document actualResponse = client.updateDocument(document, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockFirestore.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpdateDocumentRequest actualRequest = (UpdateDocumentRequest) actualRequests.get(0); Assert.assertEquals(document, actualRequest.getDocument()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }