Interface DatastoreWriter (2.24.3)

publicinterface DatastoreWriter

An interface to represent Google Cloud Datastore write operations.

Methods

add(FullEntity<?> entity)

publicabstractEntityadd(FullEntity<?>entity)

Datastore add operation: inserts the provided entity. This method will automatically allocate an id if necessary.

Parameter
Name Description
entity FullEntity<?>

the entity to add

Returns
Type Description
Entity

an Entity with the same properties and a key that is either newly allocated or the same one if key is already complete

add(FullEntity<?>[] entities)

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

Datastore add operation: inserts the provided entities. This method will automatically allocate id for any entity with an incomplete key. See Also: #add(FullEntity)

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

a list of Entity ordered by input with the same properties and a key that is either newly allocated or the same one if was already complete

delete(Key[] keys)

publicabstractvoiddelete(Key[]keys)

A datastore delete operation. It is OK to request the deletion of a non-existing key.

Parameter
Name Description
keys Key[]

put(FullEntity<?> entity)

publicabstractEntityput(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.

Parameter
Name Description
entity FullEntity<?>

the entity to put

Returns
Type Description
Entity

an Entity with the same properties and a key that is either newly allocated or the same one if key is already complete

put(FullEntity<?>[] entities)

publicabstractList<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.

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

a list of updated or inserted Entity, ordered by input. Returned keys are either newly allocated or the same one if was already complete.

update(Entity[] entities)

publicabstractvoidupdate(Entity[]entities)

A Datastore update operation. The operation will fail if an entity with the same key does not already exist.

Parameter
Name Description
entities Entity[]

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.