Hi, Wicket 1.3 is now allowing PropertyModel to access private fields of the target object. However, I am not sure if this is a recommended practice. There are basically two supporting reasons for this feature: 1) No need to generate boring getters and setters. 2) Hibernate & Spring also support this.
If we accept that 1) is a good reason for allowing private field access, then according to the same reasoning, we should always make our fields public and thus eliminate the need for getters and setters. As we are not going that, so I believe 1) is not a sufficient reason. Looking into 2), Hibernate is trying to persist the *implementation* of our class. Therefore, it may need access to its private fields. Therefore, it can be argued that Hibernate is in a special position to be granted such special access. Even so, its official documentation recommends using getters and setters (http://www.hibernate.org/hib_docs/v3/reference/en/html/persistent-classes.html#persistent-classes-pojo-accessors). However, I don't see why PropertyModel (or Wicket code in general) is in such a special position. It is part of the UI and I don't see why UI code should need access to implementation details. I don't know how Spring access private fields, so I can't comment on that one. So, is this feature a recommended practice or just a backdoor for those who prefer using public fields? ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user