 <p>I think you have alot of boiler plate code you don't need. If you do it this way you can add Commands without having to add code as well.</p> <pre><code>public interface Command { } public enum Commands { ; public static Command[] parseCommand(String command) { for (Class type : new Class[]{CameraCommand.class, RoverCommand.class}) try { return new Command[]{(Command) Enum.valueOf(type, command)}; } catch (IllegalArgumentException ignored) { } throw new IllegalArgumentException("Unknown Command " + command); } } public enum CameraCommand implements Command { CLICK } public enum RoverCommand implements Command { L, R, M; } </code></pre>