Interface EntityEditor.PersistTask<T>

Type Parameters:
T - the result type
Enclosing interface:
EntityEditor<R extends EntityEditor<R>>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface EntityEditor.PersistTask<T>

Represents a task for persisting entities, inserting, updating or deleting, split up for use with a background thread.

A EntityEditor.PersistTask captures entity state and fires "before" events at creation time. It should be executed promptly after creation, not cached for later use.

   // Must be called on the UI thread, fires "before" events and captures entity state
   PersistTask<Entity> task = editor.tasks().insert();

   // Can safely be called in a background thread
   PersistTask.Result<Entity> result = task.perform();

   // Must be called on the UI thread, fires "after" events
   Entity insertedEntity = result.handle();
See Also:
  • Method Details