Possible Duplicate:
How do I find out what type each object is in a ArrayList<Object>?
Knowing type of generic in Java
How can I retrieve the Type Foo
from my ArrayList
using the reflection in Java?
ArrayList<Foo> myList = new ArrayList<Foo>();
Possible Duplicate:
How do I find out what type each object is in a ArrayList<Object>?
Knowing type of generic in Java
How can I retrieve the Type Foo
from my ArrayList
using the reflection in Java?
ArrayList<Foo> myList = new ArrayList<Foo>();
You can't get this type from the value, but you can get it from the Field information.
prints
Fields, method arguments, return types and extended classes/interfaces can be inspected, but not local variables or values
These produce the same result.
You cannot obtain a generic type for