I think that just doing this should be OK:

Animal<Cat> animalImplCat = GWT.create(Animal.class);
Animal<Dog> animalImplDog = GWT.create(Animal.class);


The compile time generics will still be enforced during the GWT
compile, but GWT.create(Animal.class) can fill both instances.


Hope this helps, I have to say I was surprised this worked!



On Jun 7, 11:13 pm, Adolfo Panizo Touzon <adolfo.pan...@gmail.com>
wrote:
> Hello,
> I think what you wanted to explain is 
> this:http://groups.google.com/group/google-web-toolkit/browse_thread/threa...
> <http://groups.google.com/group/google-web-toolkit/browse_thread/threa...>
> From what I see, is about building a sub-interface for each class who wants
> access togeneric, isn´t it??
>
> Do you know any way to use <T> and T can take several values ​​(car.class,
> bus.class for example(which is what I can not understand))?
>
> 2011/6/7 Adolfo Panizo Touzon <adolfo.pan...@gmail.com>
>
>
>
> > Ok. I understand.
>
> > But when you said "*declare a sub-interface that "binds" the type
> > parameters*".
>
> > Can you show me a simple example?? I don´t know the way to create a one
> > generic sub-interface (create one interface for each type is simple, but one
> > generic interface to bind all the types...¿?).
>
> > Thanks a lot.
>
> > 2011/6/7 Magno Machado <magn...@gmail.com>
>
> >> Here's an exemple:
> >>https://bitbucket.org/magnomp/gwtpower/wiki/CellTableColumns
>
> >> <https://bitbucket.org/magnomp/gwtpower/wiki/CellTableColumns>However, as
> >> Thomas already said, you can't inspect the generic arguments passed 
> >> directly
> >> into GWT.create(). That is, given:
> >> GWT.create(Foo<Bar>.class), you can't see "Bar". You can, however, inspect
> >> the generic arguments passed on the superclass or implemented interfaces
>
> >> On Tue, Jun 7, 2011 at 8:31 AM, Adolfo Panizo Touzon <
> >> adolfo.pan...@gmail.com> wrote:
>
> >>> Before you ask a question.
> >>> If you don´t mind, show me a class that implements the interface Columns
> >>> , and the corresponding call GWT.create ("class that implements Columns"
> >>> );
>
> >>> My specific question is I don´t know the form to assign the genereic
> >>> type to the interface [interface colums<T>]
>
> >>> How can I specify that <T> is Car.class or Bus.car (for example)??.
>
> >>> Thanks!
>
> >>> 2011/6/7 Magno Machado <magn...@gmail.com>
>
> >>>> Check out what I did here
>
> >>>>https://bitbucket.org/magnomp/gwtpower/src/76014ca46007/src/main/java...
>
> >>>> <https://bitbucket.org/magnomp/gwtpower/src/76014ca46007/src/main/java...>I
> >>>> think what you want is lines 43/44
>
> >>>> On Tue, Jun 7, 2011 at 4:52 AM, Adolfo Panizo Touzon <
> >>>> adolfo.pan...@gmail.com> wrote:
>
> >>>>> Hi Magno, thank you very much foir your answer.
>
> >>>>> So, ohter quickly question.
>
> >>>>> Do you (or anybody) know any form to use generics in deferred binding?
>
> >>>>> Thanks.
>
> >>>>> 2011/6/6 Magno Machado <magn...@gmail.com>
>
> >>>>>> The class that your generator return doesn't exist in the project, it
> >>>>>> is always created on the fly during devmode or at compile-time
>
> >>>>>> You must have, however, a "marker" class/interface which is what will
> >>>>>> trigger the generator (it's the type that you will pass to GWT.create)
>
> >>>>>> On Mon, Jun 6, 2011 at 7:53 AM, Adolfo Panizo Touzon <
> >>>>>> adolfo.pan...@gmail.com> wrote:
>
> >>>>>>> Hi Magno,
>
> >>>>>>> but,  that subclass I must have created previously, no?
> >>>>>>> That is, in my project I have to have one *nameOfSubClass*.java with
> >>>>>>> the name of this subclass, no?
>
> >>>>>>> 2011/6/6 Magno Machado <magn...@gmail.com>
>
> >>>>>>>> You can't modify a class, but your generator can generate a subclass
> >>>>>>>> and override some method if they're not final
>
> >>>>>>>> On Mon, Jun 6, 2011 at 7:04 AM, Adolfo Panizo Touzon <
> >>>>>>>> adolfo.pan...@gmail.com> wrote:
>
> >>>>>>>>> Hi,
>
> >>>>>>>>> there any way to add code to an existing class when I'm working on
> >>>>>>>>>  a Generator?
>
> >>>>>>>>> Thanks!
>
> >>>>>>>>> --
> >>>>>>>>> El precio es lo que pagas. El valor es lo que recibes.
> >>>>>>>>> Warren Buffet
>
> >>>>>>>>> --
> >>>>>>>>> You received this message because you are subscribed to the Google
> >>>>>>>>> Groups "Google Web Toolkit" group.
> >>>>>>>>> To post to this group, send email to
> >>>>>>>>> google-web-toolkit@googlegroups.com.
> >>>>>>>>> To unsubscribe from this group, send email to
> >>>>>>>>> google-web-toolkit+unsubscr...@googlegroups.com.
> >>>>>>>>> For more options, visit this group at
> >>>>>>>>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >>>>>>>> --
> >>>>>>>> Magno Machado Paulo
> >>>>>>>>http://blog.magnomachado.com.br
> >>>>>>>>http://code.google.com/p/emballo/
>
> >>>>>>>> --
> >>>>>>>> You received this message because you are subscribed to the Google
> >>>>>>>> Groups "Google Web Toolkit" group.
> >>>>>>>> To post to this group, send email to
> >>>>>>>> google-web-toolkit@googlegroups.com.
> >>>>>>>> To unsubscribe from this group, send email to
> >>>>>>>> google-web-toolkit+unsubscr...@googlegroups.com.
> >>>>>>>> For more options, visit this group at
> >>>>>>>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >>>>>>> --
> >>>>>>> El precio es lo que pagas. El valor es lo que recibes.
> >>>>>>> Warren Buffet
>
> >>>>>>> --
> >>>>>>> You received this message because you are subscribed to the Google
> >>>>>>> Groups "Google Web Toolkit" group.
> >>>>>>> To post to this group, send email to
> >>>>>>> google-web-toolkit@googlegroups.com.
> >>>>>>> To unsubscribe from this group, send email to
> >>>>>>> google-web-toolkit+unsubscr...@googlegroups.com.
> >>>>>>> For more options, visit this group at
> >>>>>>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >>>>>> --
> >>>>>> Magno Machado Paulo
> >>>>>>http://blog.magnomachado.com.br
> >>>>>>http://code.google.com/p/emballo/
>
> >>>>>> --
> >>>>>> You received this message because you are subscribed to the Google
> >>>>>> Groups "Google Web Toolkit" group.
> >>>>>> To post to this group, send email to
> >>>>>> google-web-toolkit@googlegroups.com.
> >>>>>> To unsubscribe from this group, send email to
> >>>>>> google-web-toolkit+unsubscr...@googlegroups.com.
> >>>>>> For more options, visit this group at
> >>>>>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >>>>> --
> >>>>> El precio es lo que pagas. El valor es lo que recibes.
> >>>>> Warren Buffet
>
> >>>>> --
> >>>>> You received this message because you are subscribed to the Google
> >>>>> Groups "Google Web Toolkit" group.
> >>>>> To post to this group, send email to
> >>>>> google-web-toolkit@googlegroups.com.
> >>>>> To unsubscribe from this group, send email to
> >>>>> google-web-toolkit+unsubscr...@googlegroups.com.
> >>>>> For more options, visit this group at
> >>>>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >>>> --
> >>>> Magno Machado Paulo
> >>>>http://blog.magnomachado.com.br
> >>>>http://code.google.com/p/emballo/
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Google Web Toolkit" group.
> >>>> To post to this group, send email to
> >>>> google-web-toolkit@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> google-web-toolkit+unsubscr...@googlegroups.com.
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >>> --
> >>> El precio es lo que pagas. El valor es lo que recibes.
> >>> Warren Buffet
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Google Web Toolkit" group.
> >>> To post to this group, send email to google-web-toolkit@googlegroups.com
> >>> .
> >>> To unsubscribe from this group, send email to
> >>> google-web-toolkit+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> >> --
> >> Magno Machado Paulo
> >>http://blog.magnomachado.com.br
> >>http://code.google.com/p/emballo/
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Google Web Toolkit" group.
> >> To post to this group, send email to google-web-toolkit@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-web-toolkit+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-web-toolkit?hl=en.
>
> > --
> > El precio es lo que pagas. El valor es lo que recibes.
> > Warren Buffet
>
> --
> El precio es lo que pagas. El valor es lo que recibes.
> Warren Buffet

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to