A snippet of a strategy pattern in Java