hekailiang / squirrel

squirrel-foundation is a State Machine library, which provided a lightweight, easy use, type safe and programmable state machine implementation for Java.
http://hekailiang.github.io/squirrel/
Other
2.19k stars 540 forks source link

state 为枚举类型 callmethod warn 找不到 #73

Closed xiurierye closed 7 years ago

xiurierye commented 7 years ago

你好, 我有一个 enum类型的 state
public enum IMEIState { Init, A, B, C; } 然后 调用builder.externalTransition().from(A).to(B).on(CHECK_BEGIN).callMethod("fromAToB"); 在我的 machine中定义如下:

@StateMachineParameters(stateType=IMEIState.class, eventType=IMEIEvent.class, contextType=IMEIContext.class) public class IMEIStateMachine extends AbstractUntypedStateMachine { protected void fromAToB(IMEIState from, IMEIState to, IMEIState event, IMEIContext context) { this.fire(CHECK_TRUE,context); } }

日志输中看到: WARN [main] (MethodCallActionProxyImpl.java:61) - Cannot find method 'fromAToB' with parameters '[class com.paic.isic.ares.engine.handlers.sparta.IMEI.IMEIState, class com.paic.isic.ares.engine.handlers.sparta.IMEI.IMEIState, class com.paic.isic.ares.engine.handlers.sparta.IMEI.IMEIEvent, class com.paic.isic.ares.engine.handlers.sparta.IMEI.IMEIContext]' in class class com.paic.isic.ares.engine.handlers.sparta.IMEI.IMEIStateMachine.

我看wiki上说: Note: If you only use fluent API to define state machine, there is no need to implement corresponding converters. And also if the Event or State class is type of String or Enumeration, you don't need to implement or register a converter explicitly at most of cases. 所以我有点纳闷,找不到问题所在 ,检查了所有的参数 类型 应该都是正确的

xiurierye commented 7 years ago

自己 的 错 类型写错了 拷贝代卖的时候