T - result type for this operationpublic abstract class ApolloStoreOperation<T>
extends java.lang.Object
This class is a wrapper around operation to be performed on ApolloStore. Due to the fact that any operation
can potentially include SQLite instruction, any operation on ApolloStore must be performed in background
thread. Use enqueue(Callback) to schedule such operation in the dispatcher with a callback to get results.
| Modifier and Type | Class and Description |
|---|---|
static interface |
ApolloStoreOperation.Callback<T>
Operation result callback
|
| Modifier | Constructor and Description |
|---|---|
protected |
ApolloStoreOperation(java.util.concurrent.Executor dispatcher) |
| Modifier and Type | Method and Description |
|---|---|
static <T> ApolloStoreOperation<T> |
emptyOperation(T result) |
void |
enqueue(ApolloStoreOperation.Callback<T> callback)
Schedules operation to be executed in dispatcher
|
T |
execute()
Execute store operation
|
protected abstract T |
perform() |
protected ApolloStoreOperation(java.util.concurrent.Executor dispatcher)
public static <T> ApolloStoreOperation<T> emptyOperation(T result)
protected abstract T perform()
public final T execute() throws ApolloException
NOTE: this is a sync operation, proceed with a caution as it may include SQLite instruction
{@link - ApolloException} in case of any errorsApolloExceptionpublic void enqueue(@Nullable
ApolloStoreOperation.Callback<T> callback)
callback - to be notified about operation result