Any elegent method to build relation between string and integer in Java?
<p>I have a class which has many fields of the type String. I want to write a method as a setter for all these fields, so I need a switch. Here comes my question, how to map the field name into an integer to be fit in switch? I don't want <code>Integer.parseInt()</code>, because I don't know what char may be and couldn't choose a appropriate radix. I don't want to manually build a map neither. Is there any handy trick?</p>
