public abstract class StateCursor<T> extends Object
Constructor and Description |
---|
StateCursor(Class<T> stateClass)
Allocate new
StateCursor |
Modifier and Type | Method and Description |
---|---|
abstract void |
commit()
Commit transaction
|
void |
execute()
Execute all operations in cursor
|
T |
get(String key)
Get a value from state
|
ArrayList<T> |
getAll()
Get all values from state
|
T |
getResultValueForId(UUID id)
Fetch a result value from a completed operation
|
ArrayList<T> |
getResultValuesForId(UUID id)
Fetch a set of result values from a completed operation
|
void |
set(String key,
T value)
Set a value in state
|
StateCursor<T> |
withOperation(StateOperation<T> operation)
Add an operation for execution in the cursor
|
public StateCursor(Class<T> stateClass)
StateCursor
stateClass
- Class for state storagepublic StateCursor<T> withOperation(StateOperation<T> operation) throws StateException
operation
- StateOperationStateException
- StateExceptionpublic T getResultValueForId(UUID id) throws StateException
Only applicable for GET related operations.
id
- Operation IDStateException
- StateExceptionpublic ArrayList<T> getResultValuesForId(UUID id) throws StateException
Only applicable for GET_ALL related operations.
id
- Operation IDStateException
- StateExceptionpublic abstract void commit() throws StateException
If the cursor was created as a transaction, calling this method on the cursor will commit the transaction. If this method is called on a cursor that is not configured as a transaction, an exception will be thrown.
StateException
- StateExceptionpublic void execute() throws StateException
StateException
public void set(String key, T value) throws StateException
This is a convenience method that will add a single SET operation and call execute.
key
- Keyvalue
- ValueStateException
- StateExceptionpublic T get(String key) throws StateException
This is a convenience method that will add a single GET operation and call execute.
key
- KeyStateException
- StateExceptionpublic ArrayList<T> getAll() throws StateException
This is a convenience method that will add a single GET_ALL operation and call execute.
StateException
- StateExceptionCopyright © 2022. All rights reserved.