MyState (MyAction action) { if (MyAction.start.equals(action)) { return inProgress; } else if (MyAction.finish.equals(action)) { // to be able to be started by another request logWrongAction(this, action); return empty; } return this; }