public final class StateTransition
extends java.lang.Object
State
to
another. The originating State name and the next State
to execute are
linked by a pattern for the exit code
of an
execution of the originating State.Modifier and Type | Method and Description |
---|---|
static StateTransition |
createEndStateTransition(State state)
Create a new end state
StateTransition specification. |
static StateTransition |
createEndStateTransition(State state,
java.lang.String pattern)
Create a new end state
StateTransition specification. |
static StateTransition |
createStateTransition(State state,
java.lang.String next)
Create a new state
StateTransition specification with a wildcard
pattern that matches all outcomes. |
static StateTransition |
createStateTransition(State state,
java.lang.String pattern,
java.lang.String next)
Create a new
StateTransition specification from one State
to another (by name). |
java.lang.String |
getNext()
Public getter for the next State name.
|
java.lang.String |
getPattern() |
State |
getState()
Public getter for the State.
|
boolean |
isEnd()
Check for a special next State signalling the end of a job.
|
boolean |
matches(java.lang.String status)
Check if the provided status matches the pattern, signalling that the
next State should be executed.
|
static StateTransition |
switchOriginAndDestination(StateTransition stateTransition,
State state,
java.lang.String next)
Convenience method to switch the origin and destination of a transition,
creating a new instance.
|
java.lang.String |
toString() |
public java.lang.String getPattern()
ExitStatus.getExitCode()
will be compared against.public static StateTransition createEndStateTransition(State state)
StateTransition
specification. This
transition explicitly goes unconditionally to an end state (i.e. no more
executions).state
- the State
used to generate the outcome for this
transitionStateTransition
that was created.public static StateTransition createEndStateTransition(State state, java.lang.String pattern)
StateTransition
specification. This
transition explicitly goes to an end state (i.e. no more processing) if
the outcome matches the pattern.state
- the State
used to generate the outcome for this
transitionpattern
- the pattern to match in the exit status of the
State
StateTransition
that was created.public static StateTransition switchOriginAndDestination(StateTransition stateTransition, State state, java.lang.String next)
stateTransition
- an existing state transitionstate
- the new state for the originnext
- the new name for the destinationStateTransition
that was created.public static StateTransition createStateTransition(State state, java.lang.String next)
StateTransition
specification with a wildcard
pattern that matches all outcomes.state
- the State
used to generate the outcome for this
transitionnext
- the name of the next State
to executeStateTransition
that was created.public static StateTransition createStateTransition(State state, @Nullable java.lang.String pattern, @Nullable java.lang.String next)
StateTransition
specification from one State
to another (by name).state
- the State
used to generate the outcome for this
transitionpattern
- the pattern to match in the exit status of the
State
(can be null
)next
- the name of the next State
to execute (can be null
)StateTransition
that was created.public State getState()
public java.lang.String getNext()
public boolean matches(java.lang.String status)
status
- the status to comparepublic boolean isEnd()
public java.lang.String toString()
toString
in class java.lang.Object