Hello,
I am trying to check whether the value passed by an user is valid constant or not. Here is the code I have written.
Now, in above code if the
String passed is not withing the listed enum then it throws IllegalArgumentException which is obvious.
But my question is : Is this the proper way to validate? As we are using
Java's exception mechanism to validate.
Can someone suggest a better idea or what I have coded above itself is the best option ?
Thanks.