@java.lang.Override public com.google.firestore.v1beta1.UpdateDocumentRequest getDefaultInstanceForType() { return com.google.firestore.v1beta1.UpdateDocumentRequest.getDefaultInstance(); }
@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; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@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); }
@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())); }
/** * * * <pre> * The updated document. * Creates the document if it does not already exist. * </pre> * * <code>.google.firestore.v1beta1.Document document = 1;</code> */ public com.google.firestore.v1beta1.DocumentOrBuilder getDocumentOrBuilder() { return getDocument(); }
/** * * * <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(); }
/** * * * <pre> * An optional precondition on the document. * The request will fail if this is set and not met by the target document. * </pre> * * <code>.google.firestore.v1beta1.Precondition current_document = 4;</code> */ public com.google.firestore.v1beta1.PreconditionOrBuilder getCurrentDocumentOrBuilder() { return getCurrentDocument(); }
/** * * * <pre> * The fields to return. If not set, returns all fields. * If the document has a field that is not present in this mask, that field * will not be returned in the response. * </pre> * * <code>.google.firestore.v1beta1.DocumentMask mask = 3;</code> */ public com.google.firestore.v1beta1.DocumentMaskOrBuilder getMaskOrBuilder() { return getMask(); }
@java.lang.Override public com.google.firestore.v1beta1.UpdateDocumentRequest buildPartial() { com.google.firestore.v1beta1.UpdateDocumentRequest result = new com.google.firestore.v1beta1.UpdateDocumentRequest(this); if (documentBuilder_ == null) { result.document_ = document_; } else { result.document_ = documentBuilder_.build(); } if (updateMaskBuilder_ == null) { result.updateMask_ = updateMask_; } else { result.updateMask_ = updateMaskBuilder_.build(); } if (maskBuilder_ == null) { result.mask_ = mask_; } else { result.mask_ = maskBuilder_.build(); } if (currentDocumentBuilder_ == null) { result.currentDocument_ = currentDocument_; } else { result.currentDocument_ = currentDocumentBuilder_.build(); } onBuilt(); return result; }
@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; }
/** * Updates or inserts a document. * * <p>Sample code: * * <pre><code> * try (FirestoreClient firestoreClient = FirestoreClient.create()) { * Document document = Document.newBuilder().build(); * DocumentMask updateMask = DocumentMask.newBuilder().build(); * Document response = firestoreClient.updateDocument(document, updateMask); * } * </code></pre> * * @param document The updated document. Creates the document if it does not already exist. * @param updateMask The fields to update. None of the field paths in the mask may contain a * reserved name. * <p>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. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Document updateDocument(Document document, DocumentMask updateMask) { UpdateDocumentRequest request = UpdateDocumentRequest.newBuilder().setDocument(document).setUpdateMask(updateMask).build(); return updateDocument(request); }
io.grpc.protobuf.ProtoUtils.marshaller( com.google.firestore.v1beta1.UpdateDocumentRequest .getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
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; }
/** * Updates or inserts a document. * * <p>Sample code: * * <pre><code> * try (FirestoreClient firestoreClient = FirestoreClient.create()) { * Document document = Document.newBuilder().build(); * DocumentMask updateMask = DocumentMask.newBuilder().build(); * Document response = firestoreClient.updateDocument(document, updateMask); * } * </code></pre> * * @param document The updated document. Creates the document if it does not already exist. * @param updateMask The fields to update. None of the field paths in the mask may contain a * reserved name. * <p>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. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Document updateDocument(Document document, DocumentMask updateMask) { UpdateDocumentRequest request = UpdateDocumentRequest.newBuilder().setDocument(document).setUpdateMask(updateMask).build(); return updateDocument(request); }