类 StateTransition
- java.lang.Object
- org.springframework.batch.core.job.flow.support.StateTransition
public final class StateTransition extends java.lang.Object
Value object representing a potential transition from oneState
to another. The originating State name and the nextState
to execute are linked by a pattern for theexit code
of an execution of the originating State.- 从以下版本开始:
- 2.0
- 作者:
- Dave Syer, Michael Minella, Mahmoud Ben Hassine
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static StateTransition
createEndStateTransition(State state)
Create a new end stateStateTransition
specification.static StateTransition
createEndStateTransition(State state, java.lang.String pattern)
Create a new end stateStateTransition
specification.static StateTransition
createStateTransition(State state, java.lang.String next)
Create a new stateStateTransition
specification with a wildcard pattern that matches all outcomes.static StateTransition
createStateTransition(State state, java.lang.String pattern, java.lang.String next)
Create a newStateTransition
specification from oneState
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()
方法详细资料
getPattern
public java.lang.String getPattern()
- 返回:
- the pattern the
ExitStatus.getExitCode()
will be compared against.
createEndStateTransition
public static StateTransition createEndStateTransition(State state)
Create a new end stateStateTransition
specification. This transition explicitly goes unconditionally to an end state (i.e. no more executions).- 参数:
state
- theState
used to generate the outcome for this transition- 返回:
StateTransition
that was created.
createEndStateTransition
public static StateTransition createEndStateTransition(State state, java.lang.String pattern)
Create a new end stateStateTransition
specification. This transition explicitly goes to an end state (i.e. no more processing) if the outcome matches the pattern.- 参数:
state
- theState
used to generate the outcome for this transitionpattern
- the pattern to match in the exit status of theState
- 返回:
StateTransition
that was created.
switchOriginAndDestination
public 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.- 参数:
stateTransition
- an existing state transitionstate
- the new state for the originnext
- the new name for the destination- 返回:
StateTransition
that was created.
createStateTransition
public static StateTransition createStateTransition(State state, java.lang.String next)
Create a new stateStateTransition
specification with a wildcard pattern that matches all outcomes.- 参数:
state
- theState
used to generate the outcome for this transitionnext
- the name of the nextState
to execute- 返回:
StateTransition
that was created.
createStateTransition
public static StateTransition createStateTransition(State state, @Nullable java.lang.String pattern, @Nullable java.lang.String next)
Create a newStateTransition
specification from oneState
to another (by name).- 参数:
state
- theState
used to generate the outcome for this transitionpattern
- the pattern to match in the exit status of theState
(can benull
)next
- the name of the nextState
to execute (can benull
)- 返回:
StateTransition
that was created.
getNext
public java.lang.String getNext()
Public getter for the next State name.- 返回:
- the next
matches
public boolean matches(java.lang.String status)
Check if the provided status matches the pattern, signalling that the next State should be executed.- 参数:
status
- the status to compare- 返回:
- true if the pattern matches this status
isEnd
public boolean isEnd()
Check for a special next State signalling the end of a job.- 返回:
- true if this transition goes nowhere (there is no next)
toString
public java.lang.String toString()
- 覆盖:
toString
在类中java.lang.Object