Class MethodSelfTransition
- java.lang.Object
-
- org.apache.mina.statemachine.transition.AbstractSelfTransition
-
- org.apache.mina.statemachine.transition.MethodSelfTransition
-
- All Implemented Interfaces:
SelfTransition
public class MethodSelfTransition extends AbstractSelfTransition
SelfTransitionwhich invokes aMethod. TheMethodcan have zero or any number of StateContext and State regarding orderNormally you wouldn't create instances of this class directly but rather use the
SelfTransitionannotation to define the methods which should be used as transitions in your state machine and then letStateMachineFactorycreate aStateMachinefor you.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Object[]EMPTY_ARGUMENTSprivate static org.slf4j.LoggerLOGGERprivate java.lang.reflect.Methodmethodprivate java.lang.Objecttarget
-
Constructor Summary
Constructors Constructor Description MethodSelfTransition(java.lang.reflect.Method method, java.lang.Object target)Creates a new MethodSelfTransition instanceMethodSelfTransition(java.lang.String methodName, java.lang.Object target)Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandoExecute(StateContext stateContext, State state)Executes thisSelfTransition.java.lang.reflect.MethodgetMethod()private voidinvokeMethod(java.lang.Object[] arguments)-
Methods inherited from class org.apache.mina.statemachine.transition.AbstractSelfTransition
execute
-
-
-
-
Constructor Detail
-
MethodSelfTransition
public MethodSelfTransition(java.lang.reflect.Method method, java.lang.Object target)Creates a new MethodSelfTransition instance- Parameters:
method- The method to invoketarget- 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.
-
doExecute
public boolean doExecute(StateContext stateContext, State state)
Executes thisSelfTransition.- Specified by:
doExecutein classAbstractSelfTransition- Parameters:
stateContext- the context in which the execution should occurstate- the current state- Returns:
trueif theSelfTransitionhas been executed successfully
-
invokeMethod
private void invokeMethod(java.lang.Object[] arguments)
-
-