Re: Reflecting generics



On Fri, 31 Mar 2006 14:57:36 +0200, Domagoj Klepac
<no.spam.sent.2.domchi@xxxxxxxxxxxxxxx> wrote, quoted or indirectly
quoted someone who said :

ArrayList<String> stringArray = new ArrayList<String>();
Class c = stringArray.getClass();

Is it possible to, somehow, get "java.lang.String" from c?
Or is that information lost after compiling?

The way to do it would be to extend ArrayList where you pass the class
of the contents as a constructor parameter. Then it would exist at run
time.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.