Pattern: State, java flavour