Instead of trying to trying to put my problem into words, here's some code that demonstrates what I want to do:
Class [] domains = { Integer.class, Double.class, String.class };
String [] stringValues = { "12", "31.4", "dog" };
Comparable [] comparableObjects = { null, null, null };
for (int i = 0; i < domains.length; i++) {
// Tried the following, but it doesn't work for obvious reasons.
// It does demonstrate what I want to do.
comparableObjects[i] = (Comparable) domains[i].cast(stringValues[i]);
}
Any ideas?