I have a class that has a propery List<String> or List<SomeObject>.
I get the type of the property as this:
propertyClass = PropertyUtils.getPropertyType(currentObject, property);
What I want to do is check that the propertyClass is a List<SomeType> and get the class object for the type in the list. After this I will want to create an ArrayList of the given type and fill it with object of that type (all created dynamically, I will use this to dynamically load some data from a file).
Is there I way I can do this using reflection?
Generics are erased after compilation (due to type erasure). So you can’t use them at runtime.