Hey, mlorton! I guess you want to do something similar to what I want. Look at this code:
class Foo {
static Map <String, Integer> bar() {
return null;
}
public static void main(String[] args) throws Exception {
Method m = Foo.class.getDeclaredMethod("bar");
ParameterizedType ptype = (ParameterizedType) m.getGenericReturnType();
for (Type targ: ptype.getActualTypeArguments()) {
Class tcls = (Class) targ;
System.out.println(tcls.getName());
}
}
}
This snippet will work on any 1.5 JVM and will print: String Integer. I got this information from an IBM site: http://www-128.ibm.com/developerworks/java/library/j-cwt11085.html
It works also if you have an "bar" field instead of a method, but, I couldn't get information about the content of the field (i.e. the instance stored in the field).
Best regards,
Eduardo