Class StateMachineFactory

    • Constructor Summary

      Constructors 
      Modifier Constructor 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)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • transitionAnnotation

        private final java.lang.Class<? extends java.lang.annotation.Annotation> transitionAnnotation
      • transitionsAnnotation

        private final java.lang.Class<? extends java.lang.annotation.Annotation> transitionsAnnotation
      • entrySelfTransitionsAnnotation

        private final java.lang.Class<? extends java.lang.annotation.Annotation> entrySelfTransitionsAnnotation
      • exitSelfTransitionsAnnotation

        private final java.lang.Class<? extends java.lang.annotation.Annotation> exitSelfTransitionsAnnotation
    • Constructor Detail

      • StateMachineFactory

        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)
    • Method Detail

      • create

        public StateMachine create​(java.lang.Object handler)
        Creates a new StateMachine from the specified handler object and using a start state with id start.
        Parameters:
        handler - the object containing the annotations describing the state machine.
        Returns:
        the StateMachine object.
      • create

        public 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.
        Parameters:
        start - the id of the start State to use.
        handler - the object containing the annotations describing the state machine.
        Returns:
        the StateMachine object.
      • create

        public 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.
        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 StateMachine object.
      • create

        public 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.
        Parameters:
        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.
        Returns:
        the StateMachine object.
      • setupTransitions

        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)
      • setupSelfTransitions

        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)
      • setupTransitions

        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)
      • getFields

        static java.util.List<java.lang.reflect.Field> getFields​(java.lang.Class<?> clazz)
      • createStates

        static State[] createStates​(java.util.List<java.lang.reflect.Field> fields)