Package com.tnsai.fsm
Class State.Builder
java.lang.Object
com.tnsai.fsm.State.Builder
- Enclosing class:
State
Builder for State.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the state.initial()Marks this as an initial state.Adds metadata.onEntry(StateAction action) Sets the entry action.onExit(StateAction action) Sets the exit action.terminal()Marks this as a terminal (final) state.timeout(long timeoutMs) Sets the state timeout in milliseconds.
-
Method Details
-
initial
Marks this as an initial state.- Returns:
- this builder
-
terminal
Marks this as a terminal (final) state.- Returns:
- this builder
-
onEntry
Sets the entry action.- Parameters:
action- action to execute on entry- Returns:
- this builder
-
onExit
Sets the exit action.- Parameters:
action- action to execute on exit- Returns:
- this builder
-
timeout
Sets the state timeout in milliseconds.- Parameters:
timeoutMs- timeout in milliseconds- Returns:
- this builder
-
metadata
Adds metadata.- Parameters:
key- the keyvalue- the value- Returns:
- this builder
-
build
Builds the state.- Returns:
- new state
-