Possible Duplicate:
get type of a generic parameter in java with reflection
Java Generics Reflection: Generic field type of subclass
here's the thing. I have this code and I need to somehow get the generic information from the object.
Class A {
public static String getGenericType(Object o) {
...
}
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<Integer>();
getGenericType(list); //this should return "Integer"
}
}
I know you can get generic type from Field (Class.getField), but this is something different. Anybody knows how to get it done? Thanks in advance.
Have a nice day