Re: Reflecting generics
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 18:02:20 GMT
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.
.
- References:
- Reflecting generics
- From: Domagoj Klepac
- Reflecting generics
- Prev by Date: Re: Struts - validating foreign characters
- Next by Date: Re: Ravi
- Previous by thread: Re: Reflecting generics
- Next by thread: volatile
- Index(es):