N
Nick Coleman
I guess I'm still stuck in C programming mode, despite two semesters of
Java.
I have a bunch of static finals, one of which is S1 = "Database";
I am passed a String containing the value "S1". I want to use the value
of the String to refer to the constants and resolve (in this case) to
"Database". So that:
String static final S1 = "Database";
String key = "S1";
String result = (insert tricky stuff here); // result is "Database"
I can't use a switch statement as there is no consistency in the format
of the static constants.
I can't use a TreeMap to store the values of the constants as keys along
with their associated values (spec prevents it).
Is there a way to resolve "S1" to S1?
thanks for any help,
Nick
Java.
I have a bunch of static finals, one of which is S1 = "Database";
I am passed a String containing the value "S1". I want to use the value
of the String to refer to the constants and resolve (in this case) to
"Database". So that:
String static final S1 = "Database";
String key = "S1";
String result = (insert tricky stuff here); // result is "Database"
I can't use a switch statement as there is no consistency in the format
of the static constants.
I can't use a TreeMap to store the values of the constants as keys along
with their associated values (spec prevents it).
Is there a way to resolve "S1" to S1?
thanks for any help,
Nick