|
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.) |
- [Wicket-user] Creating a PropertyModel using a non-IMod... Frank Silbermann
- Re: [Wicket-user] Creating a PropertyModel using a... Igor Vaynberg
- Re: [Wicket-user] Creating a PropertyModel using a... Juergen Donnerstag
- Re: [Wicket-user] Creating a PropertyModel using a... Martijn Dashorst
- Re: [Wicket-user] Creating a PropertyModel usi... Dirk Markert
- Re: [Wicket-user] Creating a PropertyModel... Igor Vaynberg
- Re: [Wicket-user] Creating a PropertyM... Dirk Markert
- RE: [Wicket-user] Creating a PropertyModel using a... Frank Silbermann
- Re: [Wicket-user] Creating a PropertyModel usi... Igor Vaynberg
