Interface DatastoreWriter (2.21.1)

public interface DatastoreWriter

An interface to represent Google Cloud Datastore write operations.

Methods

add(FullEntity<?> entity)

public abstract Entity add(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)

public abstract List<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)

public abstract void delete(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)

public abstract Entity put(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)

public abstract List<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)

public abstract void update(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[]