replaced switch with Enum.valueOf... needs to try/catch though