Re: Anyway to get the generic type from a generic class?

2007-10-02 Thread Kresten Krab Thorup (Trifork)
Yes, this is quite unfortunate, and I can tell you that this is one of the issues where there was much discussion in the EG and in the groups of people trying to influence JSR 14. The bottom line is that the chosen implementation of generics works without any changes to the JVM, and that

Re: Anyway to get the generic type from a generic class?

2007-10-01 Thread Vamsavardhana Reddy
Jason, As per my understanding, an ArrayListString will help generating compilation errors should one try to add a non String object to the list. It does not mean that you can not add a non String object to the underlying list. For e.g. the following code does not result in an error: public

Re: Anyway to get the generic type from a generic class?

2007-10-01 Thread David Jencks
On Sep 30, 2007, at 10:48 PM, Jason Dillon wrote: Any of you generics experts out there know if there is any way to get the generic type from a generic class... like, say you have: Class type = new ArrayListString().getClass(); Is there any way to determine that this is an ArrayList

Re: Anyway to get the generic type from a generic class?

2007-10-01 Thread Jason Dillon
Alright... thanks, that is what I figured :-( So lame... I can figure out that a class as T and E bound, but I can't figure out the type of those buggers... so stupid :-( --jason On Sep 30, 2007, at 11:08 PM, David Jencks wrote: On Sep 30, 2007, at 10:48 PM, Jason Dillon wrote: Any of

Re: Anyway to get the generic type from a generic class?

2007-10-01 Thread Vamsavardhana Reddy
On 10/1/07, Jason Dillon [EMAIL PROTECTED] wrote: Alright... thanks, that is what I figured :-( So lame... I can figure out that a class as T and E bound, but I can't figure out the type of those buggers... The underlying object does not impose any restrictions as such (and so there is

Re: Anyway to get the generic type from a generic class?

2007-10-01 Thread Vamsavardhana Reddy
I guess he wants something like, I have an object obj which is of type ArrayListString. From this obj, I want to arrive at String which is the type of the objects the array list holds. Vamsi On 10/1/07, Gareth Evans [EMAIL PROTECTED] wrote: Hi, I use this code in a generic dao

Anyway to get the generic type from a generic class?

2007-09-30 Thread Jason Dillon
Any of you generics experts out there know if there is any way to get the generic type from a generic class... like, say you have: Class type = new ArrayListString().getClass(); Is there any way to determine that this is an ArrayList containing String objects? I can't seem to figure