no i am not pro for degenerifying it. I like the getModelObject()
and that we have to do this: TextField<Integer> integerTextField = new TextField<Integer>(this,"integerProperty", Integer.class); is just suns fault of that stupid erasure :( But i am curious about where people talk to is it just the model or are people go through componet.getModelObject() ? But then how would you generify only the models? for example if we completely remove it from the components then we have this? TextField tf = new Textfield(new Model<String>("test")); but how get we that model generified back in? tf.getModel() should return Model<String> then because if we also loose that then we can completely scrap it and i am really -1 about that. johan On 3/7/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
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