色偷偷精品伊人,欧洲久久精品,欧美综合婷婷骚逼,国产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反射不出方法,所以混著用

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

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

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

通州市| 花垣县| 长汀县| 瑞金市| 犍为县| 常山县| 乌兰察布市| 会泽县| 三台县| 确山县| 新泰市| 玛沁县| 青川县| 保亭| 灌云县| 南宁市| 油尖旺区| 焦作市| 城步| 社会| 获嘉县| 陕西省| 法库县| 河间市| 泽普县| 宁强县| 黄陵县| 类乌齐县| 井陉县| 霍城县| 金昌市| 五莲县| 平谷区| 云龙县| 望谟县| 遵化市| 青田县| 织金县| 开原市| 蒙阴县| 蕲春县|