色偷偷精品伊人,欧洲久久精品,欧美综合婷婷骚逼,国产AV主播,国产最新探花在线,九色在线视频一区,伊人大交九 欧美,1769亚洲,黄色成人av

240 發(fā)簡信
IP屬地:寧夏
  • MyStateMachineUtils類使用反射就能解決包名問題了。
    public abstract class MyStateMachineUtils extends StateMachineUtils {

    public static <S, E> void setCurrentState(StateMachine<S, E> stateMachine, S state) {
    if (stateMachine instanceof AbstractStateMachine) {
    setCurrentState((AbstractStateMachine<S, E>) stateMachine, state);

    System.out.println("StateMachine Current:" + stateMachine);
    } else {
    throw new IllegalArgumentException("Provided StateMachine is not a valid type");
    }
    }

    public static <S, E> void setCurrentState(AbstractStateMachine<S, E> stateMachine, S state) {
    Method method = ReflectUtil.getMethod(stateMachine.getClass(),"setCurrentStateInternal"
    ,State.class, Message.class, Transition.class,Boolean.class,StateMachine.class,
    Collection.class,Collection.class);
    method.setAccessible(true);
    ReflectionUtils.invokeMethod(method,stateMachine,findState(stateMachine, state), null, null, false, stateMachine,null,null);
    }

    private static <S, E> State<S, E> findState(AbstractStateMachine<S, E> stateMachine, S stateId) {
    for (State<S, E> state : stateMachine.getStates()) {
    if (state.getId() == stateId) {
    return state;
    }
    }

    throw new IllegalArgumentException("Specified State ID is not valid");
    }
    }

    ReflectUtil是hutool里的,ReflectionUtils是spring的。
    ReflectUtil能反射出方法但執(zhí)行不了,ReflectionUtils反射不出方法,所以混著用

  • 想請問下博主,既然可以直接設置當前狀態(tài)機狀態(tài)了,還需要持久化嗎

    Spring StateMachine狀態(tài)機引擎在項目中的應用(八)-靈活指定引擎實例狀態(tài)

    一直以來,總覺得ssm不夠靈活,主要原因是沒找到為狀態(tài)機指定狀態(tài)的方式,也就意味著狀態(tài)機引擎實例必須要跟對應的業(yè)務數據一起持久化,雖然ssm提供了多重持久化的方式,依然覺得有...

隆昌县| 苏尼特左旗| 元江| 广南县| 康定县| 容城县| 铜梁县| 右玉县| 汝城县| 承德县| 青州市| 芷江| 洛宁县| 中牟县| 嘉义县| 白河县| 贡山| 上蔡县| 安西县| 济宁市| 景洪市| 涪陵区| 神木县| 镇赉县| 普兰店市| 罗甸县| 龙川县| 桐柏县| 和政县| 利辛县| 长宁区| 金坛市| 潍坊市| 柞水县| 遂溪县| 无极县| 永年县| 枣阳市| 毕节市| 榆社县| 大兴区|