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:[EMAIL PROTECTED] Sent: Monday, June 02, 2008 12:03 PM
To: [email protected]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to