com.googlecode.objectify.cmd.Deleter Maven / Gradle / Ivy
Show all versions of objectify Show documentation
package com.googlecode.objectify.cmd;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Result;
/**
* The top element in the command chain for deleting entities from the datastore.
*
* You can delete entities by either passing in the POJO or their keys. Note that deletes do NOT cascade;
* you must delete each individual entity in an object graph.
*
* The {@code type()} method allows you to construct keys fluently.
*
* Note that all command objects are immutable.
*
* @author Jeff Schnitzer
*/
public interface Deleter
{
/**
* Begin construction of a key or keys to delete by specifying a kind.
*
* All command objects are immutable; this method returns a new object instead of modifying the
* current command object.
*
* @param type is the kind of object to delete.
* @return the next step in the immutable command chain where you specify a parent and/or ids.
*/
DeleteType type(Class> type);
/**
* Begin asynchronous deletion of a specific entity.
* To force synchronous delete, call now() on the returned Result.
*
* @param key defines which entity to delete
* @return an asynchronous Result. Call now() to force synchronous deletion.
*/
Result key(Key> key);
/**
* Begin asynchronous deletion of specific entities.
* To force synchronous delete, call now() on the returned Result.
*
* @param keys defines which entities to delete
* @return an asynchronous Result. Call now() to force synchronous deletion.
*/
Result keys(Iterable extends Key>> keys);
/**
* Convenient substitute for keys(Iterable)
*/
Result keys(Key>... keys);
/**
* Begin asynchronous deletion of a specific entity.
* To force synchronous delete, call now() on the returned Result.
*
* @param entity can be an entity or any key-like structure; a Key>, a native datastore Key, or an entity object with valid id/parent fields.
* @return an asynchronous Result. Call now() to force synchronous deletion.
*/
Result entity(Object entity);
/**
* Begin asynchronous deletion of specific entities.
* To force synchronous delete, call now() on the returned Result.
*
* @param entities can be entity instances or any key-like structure; a Key>, a native datastore Key, or an entity object with valid id/parent fields.
* @return an asynchronous Result. Call now() to force synchronous deletion.
*/
Result entities(Iterable> entities);
/**
* Convenient substitute for entities(Iterable)
*/
Result entities(Object... entities);
}