Interface StateContext
-
- All Known Implementing Classes:
AbstractStateContext,DefaultStateContext
public interface StateContextStateContextobjects are used to store the currentStateand any application specific attributes for a specific client of aStateMachine. SinceStateMachines are singletons and shared by all clients using theStateMachinethis is where client specific data needs to be stored.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.ObjectgetAttribute(java.lang.Object key)Returns the value of the attribute with the specified key ornullif not found.StategetCurrentState()voidsetAttribute(java.lang.Object key, java.lang.Object value)Sets the value of the attribute with the specified key.voidsetCurrentState(State state)Sets the currentState.
-
-
-
Method Detail
-
getCurrentState
State getCurrentState()
- Returns:
- the current
State. This is only meant for internal use.
-
setCurrentState
void setCurrentState(State state)
Sets the currentState. This is only meant for internal use. Don't call it directly!- Parameters:
state- the new currentState.
-
getAttribute
java.lang.Object getAttribute(java.lang.Object key)
Returns the value of the attribute with the specified key ornullif not found.- Parameters:
key- the key.- Returns:
- the value or
null.
-
setAttribute
void setAttribute(java.lang.Object key, java.lang.Object value)Sets the value of the attribute with the specified key.- Parameters:
key- the key.value- the value.
-
-