Class MethodSelfTransition

  • All Implemented Interfaces:
    SelfTransition

    public class MethodSelfTransition
    extends AbstractSelfTransition
    SelfTransition which invokes a Method. The Method can have zero or any number of StateContext and State regarding order

    Normally you wouldn't create instances of this class directly but rather use the SelfTransition annotation to define the methods which should be used as transitions in your state machine and then let StateMachineFactory create a StateMachine for you.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.Object[] EMPTY_ARGUMENTS  
      private static org.slf4j.Logger LOGGER  
      private java.lang.reflect.Method method  
      private java.lang.Object target  
    • Constructor Summary

      Constructors 
      Constructor Description
      MethodSelfTransition​(java.lang.reflect.Method method, java.lang.Object target)
      Creates a new MethodSelfTransition instance
      MethodSelfTransition​(java.lang.String methodName, java.lang.Object target)
      Creates a new instance
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • method

        private java.lang.reflect.Method method
      • target

        private final java.lang.Object target
      • EMPTY_ARGUMENTS

        private static final java.lang.Object[] EMPTY_ARGUMENTS
    • Constructor Detail

      • MethodSelfTransition

        public MethodSelfTransition​(java.lang.reflect.Method method,
                                    java.lang.Object target)
        Creates a new MethodSelfTransition instance
        Parameters:
        method - The method to invoke
        target - The target object
      • MethodSelfTransition

        public MethodSelfTransition​(java.lang.String methodName,
                                    java.lang.Object target)
        Creates a new instance
        Parameters:
        methodName - the target method.
        target - the target object.
    • Method Detail

      • getMethod

        public java.lang.reflect.Method getMethod()
        Returns:
        the target Method.
      • invokeMethod

        private void invokeMethod​(java.lang.Object[] arguments)