Class BaseDatastoreBatchWriter (2.23.0)

publicabstractclass BaseDatastoreBatchWriterimplementsDatastoreBatchWriter

Base class for DatastoreBatchWriter.

Inheritance

java.lang.Object > BaseDatastoreBatchWriter

Methods

add(FullEntity<?> entity)

publicfinalEntityadd(FullEntity<?>entity)

Datastore add operation: inserts the provided entity. This method will automatically allocate an id if necessary. If entity has a complete key and was already marked for deletion in this writer, the operation will be changed to #put.

Parameter
Name Description
entity FullEntity<?>
Returns
Type Description
Entity

add(FullEntity<?>[] entities)

publicfinalList<Entity>add(FullEntity<?>[]entities)

Datastore add operation: inserts the provided entities. This method will automatically allocate id for any entity with an incomplete key. For entities with complete keys that were marked for deletion in this writer the operation will be changed to #put.

Parameter
Name Description
entities FullEntity<?>[]
Returns
Type Description
List<Entity>

addWithDeferredIdAllocation(FullEntity<?>[] entities)

publicfinalvoidaddWithDeferredIdAllocation(FullEntity<?>[]entities)

Datastore add operation. This method will also allocate id for any entity with an incomplete key. As opposed to #add(FullEntity) and #add(FullEntity...), this method will defer any necessary id allocation to submit time.

Parameter
Name Description
entities FullEntity<?>[]

deactivate()

protectedvoiddeactivate()

delete(Key[] keys)

publicfinalvoiddelete(Key[]keys)

A datastore delete operation. It is OK to request the deletion of a non-existing key. This operation will also remove from this batch any prior writes for entities with the same keys.

Parameter
Name Description
keys Key[]

getDatastore()

protectedabstractDatastoregetDatastore()
Returns
Type Description
Datastore

getName()

protectedStringgetName()
Returns
Type Description
String

isActive()

publicbooleanisActive()

Returns true if still active (write operations were not sent to the Datastore).

Returns
Type Description
boolean

newInvalidRequest(String msg, Object[] params)

protectedDatastoreExceptionnewInvalidRequest(Stringmsg,Object[]params)
Parameters
Name Description
msg String
params Object[]
Returns
Type Description
DatastoreException

put(FullEntity<?> entity)

publicfinalEntityput(FullEntity<?>entity)

A Datastore put (a.k.a upsert) operation: inserts an entity if it does not exist, updates it otherwise. This method will automatically allocate an id if necessary. This operation will also remove from this writer any prior writes for the same entity.

Parameter
Name Description
entity FullEntity<?>
Returns
Type Description
Entity

put(FullEntity<?>[] entities)

publicfinalList<Entity>put(FullEntity<?>[]entities)

A Datastore put (a.k.a upsert) operation: creates an entity if it does not exist, updates it otherwise. This method will automatically allocate id for any entity with an incomplete key. This operation will also remove from this writer any prior writes for the same entities.

Parameter
Name Description
entities FullEntity<?>[]
Returns
Type Description
List<Entity>

putWithDeferredIdAllocation(FullEntity<?>[] entities)

publicfinalvoidputWithDeferredIdAllocation(FullEntity<?>[]entities)

Datastore put operation. This method will also allocate id for any entity with an incomplete key. As opposed to #put(FullEntity) and #put(FullEntity...), this method will defer any necessary id allocation to submit time.

Parameter
Name Description
entities FullEntity<?>[]

toAdd()

protectedMap<Key,FullEntity<Key>>toAdd()
Returns
Type Description
Map<Key,FullEntity<Key>>

toAddAutoId()

protectedList<FullEntity<IncompleteKey>>toAddAutoId()
Returns
Type Description
List<FullEntity<IncompleteKey>>

toDelete()

protectedSet<Key>toDelete()
Returns
Type Description
Set<Key>

toMutationPbList()

protectedList<Mutation>toMutationPbList()
Returns
Type Description
List<Mutation>

toPut()

protectedMap<Key,FullEntity<Key>>toPut()
Returns
Type Description
Map<Key,FullEntity<Key>>

toUpdate()

protectedMap<Key,FullEntity<Key>>toUpdate()
Returns
Type Description
Map<Key,FullEntity<Key>>

update(Entity[] entities)

publicfinalvoidupdate(Entity[]entities)

A Datastore update operation. The operation will fail if an entity with the same key does not already exist. This operation will be converted to #put operation for entities that were already added or put in this writer.

Parameter
Name Description
entities Entity[]

validateActive()

protectedvoidvalidateActive()

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.