Skip to content

Instantly share code, notes, and snippets.

@calvincodes
Created June 27, 2017 05:16
Show Gist options
  • Save calvincodes/a99f97ae48d3ff57f484d06b24461cab to your computer and use it in GitHub Desktop.
Save calvincodes/a99f97ae48d3ff57f484d06b24461cab to your computer and use it in GitHub Desktop.
@Bean
public StateMachineListener<States, Events> listener() {
return new StateMachineListenerAdapter<States, Events>() {
@Override
public void stateChanged(State<States, Events> from, State<States, Events> to) {
if (from == null) {
System.out.println("State machine initialised in state " + to.getId());
} else {
System.out.println("State changed from " + from.getId() + " to " + to.getId());
}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment