hmm, the javadoc for the constructor argument says:
@param modelObject
     *            The model object, which may or may not implement IModel

and the example given in the javadoc of the class itself shows it used with a regular object, so i dont understand where the confusion comes from.

the terminology might be somewhat generic, in javadoc a model object represents the object that an implementation of IModel locates, aka a value object. maybe thats confusing?

-Igor


On 1/24/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:

The JavaDoc for the PropertyModel constructor says that its parameters are an IModel and an OGNL string, but I noticed that the code accepts any java.lang.Object as the first parameter.  I discovered this when trying to sort out my confusion when the linkomatic example created a PropertyModel using "this" (the page itself) instead of an IModel.

 

At first I thought this looked like a hack, and asked myself:  "If you wanted to be able to accept either kind of object, why not use two constructors?"   Then I realized that java.lang.Object is the supertype of everything, and maybe Java doesn't let you create overloaded constructors where the only difference in parameter is type versus subtype.  But if the convenience of passing a non-IModel POJO is so important, then why not mention it in the JavaDoc?

 

Or is the capability of passing a non-IModel POJO to the constructor a "deprecated" capability, perhaps included to ease the conversion of programs from earlier versions of Wicket?  (If that is the case, perhaps the linkomatic example should be updated.  The Page object could easily have been wrapped before passing it to the PropertyModel constructor.)

 

 


Reply via email to