hi

I was surprised to see, in Component.setDefaultModelObject(), the following code:
       // Check whether this will result in an actual change
       if (!getModelComparator().compare(this, object))
       {
           modelChanging();
           model.setObject(object);
           modelChanged();
       }

getModelComparator() being down to, by default, a simple equals between the present model object and the object to set.

This setDefaultModelObject is called from updateModel of FormComponent.

Why is that ?

AFAIK, it brings quite some disadvantages:
- adds quite some cost (equals test can be quite expensive, and are always more than just assigning a reference) - if equals isn't properly implemented, can be either meaningless (default equals being different instances are never equals even if logically equal) or not appropriate (in entities, my equals is based on the id, which when editing obviously causes an issue here) - IModel implementations don't behave like that (setObject for a PropertyModel or a Model don't check for non equality)

Yet I don't see any added value...

In the end, I see potential for misbehavior or unexpected one and no added value.

So, why it it this way ?

thanks in advance
++

--
Joseph Pachod
IT

THOMAS DAILY GmbH
Adlerstraße 19
79098 Freiburg
Deutschland
T  + 49 761 3 85 59 506
F  + 49 761 3 85 59 550
E  joseph.pac...@thomas-daily.de
www.thomas-daily.de

Geschäftsführer/Managing Directors:
Wendy Thomas, Susanne Larbig
Handelsregister Freiburg i.Br., HRB 3947

Registrieren Sie sich unter https://www.thomas-daily.de/user/sign-in für die TD 
Morning News, eine kostenlose Auswahl aktueller Themen aus TD Premium, morgens 
ab 9:15 in Ihrer Mailbox.

Aktuelle Presseinformationen für die TD Morning News und TD Premium nimmt 
unsere Redaktion unter redakt...@thomas-daily.de entgegen.
Redaktionsschluss für die TD Morning News ist täglich um 8:45.

Register free of charge at https://www.thomas-daily.de/user/sign-in to have the 
TD Morning News, a selection of the latest topics from TD Premium, delivered to 
your mailbox from 9:15 every morning.

Our editorial department receives the latest press releases for the TD Morning News and TD Premium at redakt...@thomas-daily.de. The editorial deadline for the TD Morning News is 8.45am daily.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to