Say, I have a String values of "CHAR","VARCHAR", "NUMBER" and so on from one side and JDBCType.CHAR, JDBCType.VARCHAR, JDBCType.INTEGER from other side.
I can implement the conversion as simple as :
public static JDBCType convertFromStringToJDBCType(String datatype) {
switch(datatype) {
case "VARCHAR":
result = JDBCType.VARCHAR;
break;
case "NUMBER":
result = JDBCType.INTEGER;
break;
...
}
The downside of this approach is that I have to build the exact opposite of this function to convert values back.
What is the optimal way to implement such a conversion?