S
- the type of stateE
- the type of eventT
- the type of context objectpublic abstract class AbstractStateMachinePersister<S,E,T> extends java.lang.Object implements StateMachinePersister<S,E,T>
StateMachinePersister
easing persist
and restore operations with a StateMachinePersist
.Constructor and Description |
---|
AbstractStateMachinePersister(StateMachinePersist<S,E,T> stateMachinePersist)
Instantiates a new abstract state machine persister.
|
Modifier and Type | Method and Description |
---|---|
protected StateMachineContext<S,E> |
buildStateMachineContext(StateMachine<S,E> stateMachine)
Builds the state machine context which is used for persist operation.
|
void |
persist(StateMachine<S,E> stateMachine,
T contextObj)
Persist a state machine with a given context object.
|
StateMachine<S,E> |
restore(StateMachine<S,E> stateMachine,
T contextObj)
Reset a state machine with a given context object.
|
public AbstractStateMachinePersister(StateMachinePersist<S,E,T> stateMachinePersist)
stateMachinePersist
- the state machine persistpublic final void persist(StateMachine<S,E> stateMachine, T contextObj) throws java.lang.Exception
StateMachinePersister
persist
in interface StateMachinePersister<S,E,T>
stateMachine
- the state machinecontextObj
- the context ojbjava.lang.Exception
- the exception in case or any persist errorpublic final StateMachine<S,E> restore(StateMachine<S,E> stateMachine, T contextObj) throws java.lang.Exception
StateMachinePersister
restore
in interface StateMachinePersister<S,E,T>
stateMachine
- the state machinecontextObj
- the context ojbjava.lang.Exception
- the exception in case or any persist errorprotected StateMachineContext<S,E> buildStateMachineContext(StateMachine<S,E> stateMachine)
stateMachine
- the state machine