Class StateMachineFactory
java.lang.Object
org.apache.mina.statemachine.StateMachineFactory
Creates
StateMachines by reading State,
Transition and Transitions (or equivalent) and SelfTransition annotations from one or more arbitrary
objects.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Class<? extends Annotation> private final Class<? extends Annotation> private final Class<? extends Annotation> private final Class<? extends Annotation> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStateMachineFactory(Class<? extends Annotation> transitionAnnotation, Class<? extends Annotation> transitionsAnnotation, Class<? extends Annotation> entrySelfTransitionsAnnotation, Class<? extends Annotation> exitSelfTransitionsAnnotation) -
Method Summary
Modifier and TypeMethodDescriptionCreates a newStateMachinefrom the specified handler object and using a start state with idstart.Creates a newStateMachinefrom the specified handler objects and using a start state with idstart.Creates a newStateMachinefrom the specified handler object and using theStatewith the specified id as start state.Creates a newStateMachinefrom the specified handler objects and using theStatewith the specified id as start state.(package private) static State[]createStates(List<Field> fields) static StateMachineFactorygetInstance(Class<? extends Annotation> transitionAnnotation) Returns a newStateMachineFactoryinstance which createsStateMachines by reading the specifiedTransitionequivalent annotation.private static voidsetupSelfTransitions(Method m, Class<? extends Annotation> onEntrySelfTransitionAnnotation, Class<? extends Annotation> onExitSelfTransitionAnnotation, Map<String, State> states, Object handler) private static voidsetupTransitions(Class<? extends Annotation> transitionAnnotation, Class<? extends Annotation> transitionsAnnotation, Class<? extends Annotation> onEntrySelfTransitionAnnotation, Class<? extends Annotation> onExitSelfTransitionAnnotation, Map<String, State> states, Object handler) private static voidsetupTransitions(Class<? extends Annotation> transitionAnnotation, Class<? extends Annotation> transitionsAnnotation, Class<? extends Annotation> onEntrySelfTransitionAnnotation, Class<? extends Annotation> onExitSelfTransitionAnnotation, Map<String, State> states, List<Object> handlers)
-
Field Details
-
transitionAnnotation
-
transitionsAnnotation
-
entrySelfTransitionsAnnotation
-
exitSelfTransitionsAnnotation
-
-
Constructor Details
-
StateMachineFactory
protected StateMachineFactory(Class<? extends Annotation> transitionAnnotation, Class<? extends Annotation> transitionsAnnotation, Class<? extends Annotation> entrySelfTransitionsAnnotation, Class<? extends Annotation> exitSelfTransitionsAnnotation)
-
-
Method Details
-
getInstance
Returns a newStateMachineFactoryinstance which createsStateMachines by reading the specifiedTransitionequivalent annotation.- Parameters:
transitionAnnotation- theTransitionequivalent annotation.- Returns:
- the
StateMachineFactory.
-
create
Creates a newStateMachinefrom the specified handler object and using a start state with idstart.- Parameters:
handler- the object containing the annotations describing the state machine.- Returns:
- the
StateMachineobject.
-
create
Creates a newStateMachinefrom the specified handler object and using theStatewith the specified id as start state.- Parameters:
start- the id of the startStateto use.handler- the object containing the annotations describing the state machine.- Returns:
- the
StateMachineobject.
-
create
Creates a newStateMachinefrom the specified handler objects and using a start state with idstart.- Parameters:
handler- the first object containing the annotations describing the state machine.handlers- zero or more additional objects containing the annotations describing the state machine.- Returns:
- the
StateMachineobject.
-
create
Creates a newStateMachinefrom the specified handler objects and using theStatewith the specified id as start state.- Parameters:
start- the id of the startStateto use.handler- the first object containing the annotations describing the state machine.handlers- zero or more additional objects containing the annotations describing the state machine.- Returns:
- the
StateMachineobject.
-
setupTransitions
private static void setupTransitions(Class<? extends Annotation> transitionAnnotation, Class<? extends Annotation> transitionsAnnotation, Class<? extends Annotation> onEntrySelfTransitionAnnotation, Class<? extends Annotation> onExitSelfTransitionAnnotation, Map<String, State> states, List<Object> handlers) -
setupSelfTransitions
private static void setupSelfTransitions(Method m, Class<? extends Annotation> onEntrySelfTransitionAnnotation, Class<? extends Annotation> onExitSelfTransitionAnnotation, Map<String, State> states, Object handler) -
setupTransitions
private static void setupTransitions(Class<? extends Annotation> transitionAnnotation, Class<? extends Annotation> transitionsAnnotation, Class<? extends Annotation> onEntrySelfTransitionAnnotation, Class<? extends Annotation> onExitSelfTransitionAnnotation, Map<String, State> states, Object handler) -
getFields
-
createStates
-