public abstract class UpdateBuilder<T>
Abstract class that collects and bundles all write operations for Transaction and WriteBatch.
Type Parameter
Name | Description |
T |
Fields
committed
protected boolean committed
Type | Description |
boolean |
Methods
create(DocumentReference documentReference, Object pojo)
public T create(DocumentReference documentReference, Object pojo)
Creates a new Document at the DocumentReference location. It fails the write if the document exists.
Name | Description |
documentReference | DocumentReference The DocumentReference to create. |
pojo | Object The POJO that will be used to populate the document contents. |
Type | Description |
T | The instance for chaining. |
create(DocumentReference documentReference, Map<String,Object> fields)
public T create(DocumentReference documentReference, Map<String,Object> fields)
Creates a new Document at the DocumentReference's location. It fails the write if the document exists.
Name | Description |
documentReference | DocumentReference The DocumentReference to create. |
fields | Map<String,Object> A map of the fields and values for the document. |
Type | Description |
T | The instance for chaining. |
delete(DocumentReference documentReference)
public T delete(DocumentReference documentReference)
Deletes the document referred to by this DocumentReference.
Name | Description |
documentReference | DocumentReference The DocumentReference to delete. |
Type | Description |
T | The instance for chaining. |
delete(DocumentReference documentReference, Precondition precondition)
public T delete(DocumentReference documentReference, Precondition precondition)
Deletes the document referred to by this DocumentReference.
Name | Description |
documentReference | DocumentReference The DocumentReference to delete. |
precondition | Precondition Precondition for the delete operation. |
Type | Description |
T | The instance for chaining. |
getMutationsSize()
public int getMutationsSize()
Get the number of writes.
Type | Description |
int |
set(DocumentReference documentReference, Object pojo)
public T set(DocumentReference documentReference, Object pojo)
Overwrites the document referred to by this DocumentReference. If the document doesn't exist yet, it will be created. If a document already exists, it will be overwritten.
Name | Description |
documentReference | DocumentReference The DocumentReference to overwrite. |
pojo | Object The POJO that will be used to populate the document contents. |
Type | Description |
T | The instance for chaining. |
set(DocumentReference documentReference, Object pojo, SetOptions options)
public T set(DocumentReference documentReference, Object pojo, SetOptions options)
Overwrites the document referred to by this DocumentReference. If the document doesn't exist yet, it will be created. If you pass SetOptions, the provided data can be merged into an existing document.
Name | Description |
documentReference | DocumentReference The DocumentReference to overwrite. |
pojo | Object The POJO that will be used to populate the document contents. |
options | SetOptions An object to configure the set behavior. |
Type | Description |
T | The instance for chaining. |
set(DocumentReference documentReference, Map<String,Object> fields)
public T set(DocumentReference documentReference, Map<String,Object> fields)
Overwrites the document referred to by this DocumentReference. If the document doesn't exist yet, it will be created. If a document already exists, it will be overwritten.
Name | Description |
documentReference | DocumentReference The DocumentReference to overwrite. |
fields | Map<String,Object> A map of the field paths and values for the document. |
Type | Description |
T | The instance for chaining. |
set(DocumentReference documentReference, Map<String,Object> fields, SetOptions options)
public T set(DocumentReference documentReference, Map<String,Object> fields, SetOptions options)
Overwrites the document referred to by this DocumentReference. If the document doesn't exist yet, it will be created. If you pass SetOptions, the provided data can be merged into an existing document.
Name | Description |
documentReference | DocumentReference The DocumentReference to overwrite. |
fields | Map<String,Object> A map of the field paths and values for the document. |
options | SetOptions An object to configure the set behavior. |
Type | Description |
T | The instance for chaining. |
update(DocumentReference documentReference, FieldPath fieldPath, Object value, Object[] moreFieldsAndValues)
public T update(DocumentReference documentReference, FieldPath fieldPath, Object value, Object[] moreFieldsAndValues)
Updates the fields in the document referred to by this DocumentReference. If the document doesn't exist yet, the update will fail.
Name | Description |
documentReference | DocumentReference The DocumentReference to update. |
fieldPath | FieldPath The first field to set. |
value | Object The first value to set. |
moreFieldsAndValues | Object[] String and Object pairs with more fields to be set. |
Type | Description |
T | The instance for chaining. |
update(DocumentReference documentReference, Precondition precondition, FieldPath fieldPath, Object value, Object[] moreFieldsAndValues)
public T update(DocumentReference documentReference, Precondition precondition, FieldPath fieldPath, Object value, Object[] moreFieldsAndValues)
Updates the fields in the document referred to by this DocumentReference. If the document doesn't exist yet, the update will fail.
Name | Description |
documentReference | DocumentReference The DocumentReference to update. |
precondition | Precondition Precondition to enforce on this update. |
fieldPath | FieldPath The first field to set. |
value | Object The first value to set. |
moreFieldsAndValues | Object[] String and Object pairs with more fields to be set. |
Type | Description |
T | The instance for chaining. |
update(DocumentReference documentReference, Precondition precondition, String field, Object value, Object[] moreFieldsAndValues)
public T update(DocumentReference documentReference, Precondition precondition, String field, Object value, Object[] moreFieldsAndValues)
Updates the fields in the document referred to by this DocumentReference. If the document doesn't exist yet, the update will fail.
Name | Description |
documentReference | DocumentReference The DocumentReference to update. |
precondition | Precondition Precondition to enforce on this update. |
field | String The first field to set. |
value | Object The first value to set. |
moreFieldsAndValues | Object[] String and Object pairs with more fields to be set. |
Type | Description |
T | The instance for chaining. |
update(DocumentReference documentReference, String field, Object value, Object[] moreFieldsAndValues)
public T update(DocumentReference documentReference, String field, Object value, Object[] moreFieldsAndValues)
Updates the fields in the document referred to by this DocumentReference. If the document doesn't exist yet, the update will fail.
Name | Description |
documentReference | DocumentReference The DocumentReference to update. |
field | String The first field to set. |
value | Object The first value to set. |
moreFieldsAndValues | Object[] String and Object pairs with more fields to be set. |
Type | Description |
T | The instance for chaining. |
update(DocumentReference documentReference, Map<String,Object> fields)
public T update(DocumentReference documentReference, Map<String,Object> fields)
Updates fields in the document referred to by this DocumentReference. If the document doesn't exist yet, the update will fail.
Name | Description |
documentReference | DocumentReference The DocumentReference to update. |
fields | Map<String,Object> A Map containing the fields and values with which to update the document. |
Type | Description |
T | The instance for chaining. |
update(DocumentReference documentReference, Map<String,Object> fields, Precondition precondition)
public T update(DocumentReference documentReference, Map<String,Object> fields, Precondition precondition)
Updates fields in the document referred to by this DocumentReference. If the document doesn't exist yet, the update will fail.
Name | Description |
documentReference | DocumentReference The DocumentReference to update. |
fields | Map<String,Object> A Map containing the fields and values with which to update the document. |
precondition | Precondition Precondition to enforce on this update. |
Type | Description |
T | The instance for chaining. |