S
- the type of stateE
- the type of eventpublic abstract class AbstractStateMachineModelFactory<S,E> extends java.lang.Object implements StateMachineComponentResolver<S,E>, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.ResourceLoaderAware
StateMachineModelFactory
providing
some common grounds for various implementations.
This factory is able to resolve Action
s or Guard
s either from
a BeanFactory
if knows, or from manually registered instances. Manually
registered actions or guards are needed if those are not created as beans or if
whole state machine is working outside of an application context.Constructor and Description |
---|
AbstractStateMachineModelFactory() |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.beans.factory.BeanFactory |
getBeanFactory()
Gets the bean factory.
|
protected org.springframework.core.io.ResourceLoader |
getResourceLoader()
Gets the resource loader.
|
void |
registerAction(java.lang.String id,
Action<S,E> action)
Register
Action into factory with a given id. |
void |
registerGuard(java.lang.String id,
Guard<S,E> guard)
Register
Guard into factory with a given id. |
Action<S,E> |
resolveAction(java.lang.String id)
Resolve action.
|
Guard<S,E> |
resolveGuard(java.lang.String id)
Resolve guard.
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
org.springframework.beans.BeansException
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
public void registerAction(java.lang.String id, Action<S,E> action)
Action
into factory with a given id.registerAction
in interface StateMachineComponentResolver<S,E>
id
- the idaction
- the actionpublic void registerGuard(java.lang.String id, Guard<S,E> guard)
Guard
into factory with a given id.registerGuard
in interface StateMachineComponentResolver<S,E>
id
- the idguard
- the guardprotected final org.springframework.beans.factory.BeanFactory getBeanFactory()
protected org.springframework.core.io.ResourceLoader getResourceLoader()
public Action<S,E> resolveAction(java.lang.String id)
resolveAction
in interface StateMachineComponentResolver<S,E>
id
- the idpublic Guard<S,E> resolveGuard(java.lang.String id)
resolveGuard
in interface StateMachineComponentResolver<S,E>
id
- the id