public class StateMachineFactory
extends java.lang.Object
StateMachines by reading State,
Transition and Transitions (or equivalent) and SelfTransition annotations from one or more arbitrary
objects.| Modifier and Type | Class and Description |
|---|---|
private static class |
StateMachineFactory.TransitionsWrapper |
private static class |
StateMachineFactory.TransitionWrapper |
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Class<? extends java.lang.annotation.Annotation> |
entrySelfTransitionsAnnotation |
private java.lang.Class<? extends java.lang.annotation.Annotation> |
exitSelfTransitionsAnnotation |
private java.lang.Class<? extends java.lang.annotation.Annotation> |
transitionAnnotation |
private java.lang.Class<? extends java.lang.annotation.Annotation> |
transitionsAnnotation |
| Modifier | Constructor and Description |
|---|---|
protected |
StateMachineFactory(java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> transitionsAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> entrySelfTransitionsAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> exitSelfTransitionsAnnotation) |
| Modifier and Type | Method and Description |
|---|---|
StateMachine |
create(java.lang.Object handler)
Creates a new
StateMachine from the specified handler object and
using a start state with id start. |
StateMachine |
create(java.lang.Object handler,
java.lang.Object... handlers)
Creates a new
StateMachine from the specified handler objects and
using a start state with id start. |
StateMachine |
create(java.lang.String start,
java.lang.Object handler)
Creates a new
StateMachine from the specified handler object and
using the State with the specified id as start state. |
StateMachine |
create(java.lang.String start,
java.lang.Object handler,
java.lang.Object... handlers)
Creates a new
StateMachine from the specified handler objects and
using the State with the specified id as start state. |
(package private) static State[] |
createStates(java.util.List<java.lang.reflect.Field> fields) |
(package private) static java.util.List<java.lang.reflect.Field> |
getFields(java.lang.Class<?> clazz) |
static StateMachineFactory |
getInstance(java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation)
Returns a new
StateMachineFactory instance which creates
StateMachines by reading the specified Transition
equivalent annotation. |
private static void |
setupSelfTransitions(java.lang.reflect.Method m,
java.lang.Class<? extends java.lang.annotation.Annotation> onEntrySelfTransitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onExitSelfTransitionAnnotation,
java.util.Map<java.lang.String,State> states,
java.lang.Object handler) |
private static void |
setupTransitions(java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> transitionsAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onEntrySelfTransitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onExitSelfTransitionAnnotation,
java.util.Map<java.lang.String,State> states,
java.util.List<java.lang.Object> handlers) |
private static void |
setupTransitions(java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> transitionsAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onEntrySelfTransitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onExitSelfTransitionAnnotation,
java.util.Map<java.lang.String,State> states,
java.lang.Object handler) |
private final java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation
private final java.lang.Class<? extends java.lang.annotation.Annotation> transitionsAnnotation
private final java.lang.Class<? extends java.lang.annotation.Annotation> entrySelfTransitionsAnnotation
private final java.lang.Class<? extends java.lang.annotation.Annotation> exitSelfTransitionsAnnotation
protected StateMachineFactory(java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> transitionsAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> entrySelfTransitionsAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> exitSelfTransitionsAnnotation)
public static StateMachineFactory getInstance(java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation)
StateMachineFactory instance which creates
StateMachines by reading the specified Transition
equivalent annotation.transitionAnnotation - the Transition equivalent annotation.StateMachineFactory.public StateMachine create(java.lang.Object handler)
StateMachine from the specified handler object and
using a start state with id start.handler - the object containing the annotations describing the
state machine.StateMachine object.public StateMachine create(java.lang.String start, java.lang.Object handler)
StateMachine from the specified handler object and
using the State with the specified id as start state.start - the id of the start State to use.handler - the object containing the annotations describing the
state machine.StateMachine object.public StateMachine create(java.lang.Object handler, java.lang.Object... handlers)
StateMachine from the specified handler objects and
using a start state with id start.handler - the first object containing the annotations describing the
state machine.handlers - zero or more additional objects containing the
annotations describing the state machine.StateMachine object.public StateMachine create(java.lang.String start, java.lang.Object handler, java.lang.Object... handlers)
StateMachine from the specified handler objects and
using the State with the specified id as start state.start - the id of the start State to 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.StateMachine object.private static void setupTransitions(java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> transitionsAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onEntrySelfTransitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onExitSelfTransitionAnnotation,
java.util.Map<java.lang.String,State> states,
java.util.List<java.lang.Object> handlers)
private static void setupSelfTransitions(java.lang.reflect.Method m,
java.lang.Class<? extends java.lang.annotation.Annotation> onEntrySelfTransitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onExitSelfTransitionAnnotation,
java.util.Map<java.lang.String,State> states,
java.lang.Object handler)
private static void setupTransitions(java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> transitionsAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onEntrySelfTransitionAnnotation,
java.lang.Class<? extends java.lang.annotation.Annotation> onExitSelfTransitionAnnotation,
java.util.Map<java.lang.String,State> states,
java.lang.Object handler)
static java.util.List<java.lang.reflect.Field> getFields(java.lang.Class<?> clazz)
static State[] createStates(java.util.List<java.lang.reflect.Field> fields)