Interface CommandContext
public interface CommandContext
-
Method Summary
Modifier and TypeMethodDescriptionReturns the current persist context in use.Mode
<?> getMode()
Returns the mode that was supplied to the initial invocation.Returns theQueryBuilderFactory
service.perform
(Mode<E> mode, PersistTask<A, T> task, Optional<A> arg) Performs the given command with the given mode.<A,
T> Optional <T> perform
(PersistTask<A, T> task) Performs the given command with the same mode as supplied to the parent invocation without wrappingPersistException
s, but instead propagating them.<A,
T> Optional <T> perform
(PersistTask<A, T> task, A arg) Performs the given command with the same mode as supplied to the parent invocation without wrappingPersistException
s, but instead propagating them.<A,
T> Optional <T> perform
(PersistTask<A, T> task, Optional<A> arg) Performs the given command with the same mode as supplied to the parent invocation without wrappingPersistException
s, but instead propagating them.performInterruptible
(Mode<E> mode, PersistTask<A, T> task, A arg) Deprecated.Creates a copy of thisCommandContext
but using a differentContext
.
-
Method Details
-
getMode
Mode<?> getMode()Returns the mode that was supplied to the initial invocation. -
getContext
Context getContext()Returns the current persist context in use. -
getContextManager
ContextManager getContextManager() -
getPersistenceService
PersistenceService getPersistenceService() -
getQueryBuilderFactory
QueryBuilderFactory getQueryBuilderFactory()Returns theQueryBuilderFactory
service. -
perform
Performs the given command with the same mode as supplied to the parent invocation without wrappingPersistException
s, but instead propagating them. This can be used to execute nested commands.- Throws:
Exception
-
perform
Performs the given command with the same mode as supplied to the parent invocation without wrappingPersistException
s, but instead propagating them. This can be used to execute nested commands.- Throws:
Exception
-
perform
Performs the given command with the same mode as supplied to the parent invocation without wrappingPersistException
s, but instead propagating them. This can be used to execute nested commands. The argument `Optional.empty()` is passed to the given task.- Throws:
Exception
-
perform
<A,T, Optional<T> performE extends Exception> (Mode<E> mode, PersistTask<A, T> task, Optional<A> arg) throws EPerforms the given command with the given mode. That is the same asCommandExecutor.perform(Mode, PersistTask, Object)
.- Type Parameters:
A
- type of input to the taskT
- result type of the taskE
- exception type- Throws:
E
-
using
Creates a copy of thisCommandContext
but using a differentContext
. This method is useful if a nested task should be executed with a different context. -
performInterruptible
@Deprecated default <A,T, Optional<T> performInterruptibleE extends Exception> (Mode<E> mode, PersistTask<A, T> task, A arg) throws EDeprecated.Performs the given command with the given mode. That is the same asCommandExecutor.performInterruptible(Mode, PersistTask, Object)
.- Type Parameters:
A
- type of input to the taskT
- result type of the taskE
- exception type- Parameters:
mode
- the mode to execute the task intask
- the taskarg
- the argument to pass to the task- Returns:
- the result of the task
- Throws:
E
- the exception thrown by the task
-
perform(Mode, PersistTask, Optional)