« Return to Thread: users, please give us your opinion: what is your take on generics with Wicket

Re: users, please give us your opinion: what is your take on generics with Wicket

by Sebastiaan van Erk :: Rate this Message:

Reply to Author | View in Thread

You could use Java's covariant return types to override getModel() to
return a specific type. Which would mean that you would need to subclass
to "simulate" generics (with a new subclass for each type). Also, when
using anonymous subclasses it becomes rather pointless and you'd be back
to casting.

Regards,
Sebastiaan

Hoover, William wrote:

> Wouldn't that infer that the component has to have generics, or am I
> missing something here?
>
> Something like...
>
> public abstract class Component<M extends IModel<T>, T> implements
> IClusterable, IConverterLocator {
> ...
> public final M getModel(){
> ...
> }
> ...
> public final T getModelObject(){
> ...
> }
> ...
> }
>
> -----Original Message-----
> From: Jan Kriesten [mailto:jan.kriesten@...]
> Sent: Monday, June 02, 2008 12:03 PM
> To: users@...
> Subject: Re: users, please give us your opinion: what is your take on
> generics with Wicket
>
>
> Hi Sebastian,
>
>> What about getModel()? If componennt is not generified I'm really
>> wondering if the there is any benefit to generics at all... (I do
>> really think it will spawn lots of questions on the list as well).
>
> what's the problem with getModel? If you specialize on a certain
> Component, you can implement T getModel() ?
>
> Regards, --- Jan.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


smime.p7s (4K) Download Attachment

 « Return to Thread: users, please give us your opinion: what is your take on generics with Wicket