Hi,

I think we went overboard applying generics in Wicket.

Things like:
TextField<Integer> integerTextField = new TextField<Integer>(this,
"integerProperty", Integer.class);

are just horrible imo. Sure, you can do:

Integer i = integerTextField.getModelObject();

instead of:

Integer i = (Integer)integerTextField.getModelObject();

but that's about the whole great benefit of generic components for the
price of about twice the verbosity.

Also, calling getModelObject is the kind of convenience method that
grew upon us but that I personally never liked. It saves an ugly model
check, fine, but in general I think users should try to directly work
with models and their underlying objects instead.

I can see the method come in handy in list views (on ListItem), though
then again, you know the model object would never be null there so
getModel().getObject() would work as well.

Anyway, what I'd like us to consider is to de-generify components and
only keep it for models. For certain components (like ListView) we/
users can decide to introduce it, but the general case would be to not
to.

Thoughts? Screams?

Eelco

Reply via email to