Class StateMachineUtils
java.lang.Object
org.springframework.statemachine.support.StateMachineUtils
Various utility methods for state machine.
- Author:
- Janne Valkealahti
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <S> booleancontainsAtleastOne(Collection<S> left, Collection<S> right) Checks if right hand collection has atleast one same item as left hand collection.static booleancontainsAtleastOneEqualString(Collection<String> left, String right) static booleancontainsAtleastOneEqualString(Collection<String> left, Collection<String> right) static <S,E> Long getMessageHeaderDoActionTimeout(StateContext<S, E> context) Gets a particular message header from aStateContextand parses it toLong.static <S,E> boolean isNormalPseudoState(State<S, E> state) Checks if state is a normal pseudo state, meaning it is a pseudostate and its kind is not initial or end.static <S,E> boolean isPseudoState(State<S, E> state, PseudoStateKind kind) static <S,E> boolean isSubstate(State<S, E> left, State<S, E> right) Checks if right hand side is a substate of a left hand side.static <S,E> boolean isTransientPseudoState(State<S, E> state) Checks if state is a transient pseudo state, meaning it is a pseudostate and its kind indicates that machine will never stay on this state after run to completion has finished.Utility function to stash error into reactor context.static Collection<String>toStringCollection(Object object) static <S> Collection<String>toStringCollection(Collection<S> collection)
-
Constructor Details
-
StateMachineUtils
public StateMachineUtils()
-
-
Method Details
-
isSubstate
Checks if right hand side is a substate of a left hand side.- Type Parameters:
S- the type of stateE- the type of event- Parameters:
left- the super stateright- the sub state- Returns:
- if sub is child of super
-
containsAtleastOne
Checks if right hand collection has atleast one same item as left hand collection.- Type Parameters:
S- the generic type- Parameters:
left- the left collectionright- the right collection- Returns:
- true, right contains at least one item from left, false otherwise.
-
isNormalPseudoState
Checks if state is a normal pseudo state, meaning it is a pseudostate and its kind is not initial or end.- Type Parameters:
S- the type of stateE- the type of event- Parameters:
state- the state- Returns:
- true, if is normal pseudo state
-
isTransientPseudoState
Checks if state is a transient pseudo state, meaning it is a pseudostate and its kind indicates that machine will never stay on this state after run to completion has finished.- Type Parameters:
S- the type of stateE- the type of event- Parameters:
state- the state- Returns:
- true, if is normal pseudo state
-
isPseudoState
-
toStringCollection
-
toStringCollection
-
containsAtleastOneEqualString
-
containsAtleastOneEqualString
public static boolean containsAtleastOneEqualString(Collection<String> left, Collection<String> right) -
getMessageHeaderDoActionTimeout
Gets a particular message header from aStateContextand parses it toLong. Any error parsing header resultsNULL.- Type Parameters:
S- the type of stateE- the type of event- Parameters:
context- the state context- Returns:
- the header as
LongorNULL
-
resumeErrorToContext
Utility function to stash error into reactor context.- Returns:
- mono for completion
-