我正在使用 StateMachineBuilder 创建状态机,因为我需要以编程方式使用它来配置状态和转换。
但是由于一些需求变化,我的配置几乎是不变的,现在我想使用 eclipse uml 建模,因为我不再需要动态或以编程方式构建状态机。为了避免大的代码返工,我想在 builder 中使用 UmlStateMachineModelFactory ,如下所示。
Builder<String, String> builder = StateMachineBuilder
.<String, String> builder();
builder.configureConfiguration()
.withConfiguration()
.autoStartup(false)
.listener(listener())
.beanFactory(
this.applicationContext.getAutowireCapableBeanFactory());
builder.configureModel().withModel().factory(new UmlStateMachineModelFactory("classpath:model2.uml"));
1)在状态机中是否合法,如果是,我如何为每个状态附加进入操作?
目前使用构建器,我正在使用以下代码为每个状态附加入口操作
stateConfigurer.state("State1", this.state1EntryAction, null);
// State1EntryAction is @Autowired inside my controller class and
// State1EntryAction implements Action<String, String> and
// annotated with @Component (org.springframework.stereotype.Component)
2)我可以在uml模型中给出入口动作类的名称,以便为每个阶段附加入口动作吗?如果是这样,我怎么能在日食纸莎草纸中做到这一点。
提前致谢!