For my java console application, I need to call a set of functions with user given arguments. My operations O1, O2, .. O5 are defined as an enum as
enum Operations {O1, O2, O3, O4, O5};
I need to read user input args[0] and call function F1, F2,…F5.
For example user is going to give:
>java MyApp O1 5 6
For this I suppose I need to map sting (args[0]) to an enum so that I can use switch select. How to do this?
Enum.valueOf(Class, String).Example
Will throw an exception if there are no enum values that matches
args[0]