Using the Enum.valueOf(String) method instead of a switch statement