首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

生命周期组件框架:生命周期描述语言——复合状态机示范

2013-11-26 
生命周期组件框架:生命周期描述语言——复合状态机示例@StateMachinestatic interface OrderLifecycle {@Sta

生命周期组件框架:生命周期描述语言——复合状态机示例

    @StateMachine    static interface OrderLifecycle {        @StateSet        static interface States {            @Initial            @Function(transition = Transitions.Start.class, value = Started.class)            static interface Created {}            @CompositeState            @Function(transition = Transitions.Cancel.class, value = Canceled.class)            static interface Started {                @StateSet                static interface SubStates {                    @Initial                    @Function(transition = OrderLifecycle.States.Started.SubTransitions.DoProduce.class, value = Producing.class)                    static interface OrderCreated {}                    @Function(transition = OrderLifecycle.States.Started.SubTransitions.DoDeliver.class, value = Delivering.class)                    static interface Producing {}                    @Function(transition = OrderLifecycle.States.Started.SubTransitions.ConfirmComplete.class, value = Done.class)                    static interface Delivering {}                    @End                    @ShortCut(OrderLifecycle.States.Finished.class)                    static interface Done {}                }                @TransitionSet                static interface SubTransitions {                    static interface DoProduce {}                    static interface DoDeliver {}                    static interface ConfirmComplete {}                }            }            @End            static interface Finished {}            @End            static interface Canceled {}        }        @TransitionSet        static interface Transitions {            static interface Start {}            static interface Cancel {}        }    }    public abstract static class ProductBase extends ReactiveObject {}    @LifecycleMeta(OrderLifecycle.class)    public static class ProductOrder extends ProductBase {        public ProductOrder() {            initialState(OrderLifecycle.States.Created.class.getSimpleName());        }        @Transition        public void start() {}        @Transition        public void cancel() {}        @Transition        public void doProduce() {}        @Transition        public void doDeliver() {}        @Transition        public void confirmComplete() {}    }

?前文:生命周期组件框架——关系型状态及服务

热点排行