On Thu, Apr 21, 2016 at 10:23 AM, Sven Meier <[email protected]> wrote:
> Hi, > > >Is it a good idea to use Model.of(object) instead of throwing exception at > >org.apache.wicket.Component#setDefaultModelObject() > >when there is no model > > no, I don't think we should change that. > > Why do see the need for this? A colleague of mine asked me "What this error means? Why Wicket allows me to call this method and then breaks at runtime?" ... In case the change is not approved then I'll try to improve the error message. > > > Sven > > > > On 21.04.2016 10:11, Martin Grigorov wrote: > >> Hi, >> >> Is it a good idea to use Model.of(object) instead of throwing exception at >> org.apache.wicket.Component#setDefaultModelObject() [1] when there is no >> model for this object. >> In addition we may log a WARN message explaining that a sub-optimal IModel >> impl might be used and the developer will have to either provide a model >> before using #setDefaultModelObject() or use #setDefaultModel() instead. >> >> >> 1. >> >> https://github.com/apache/wicket/blob/1cf2a93eb28560e412365d8d6ef1c86d93006f37/wicket-core/src/main/java/org/apache/wicket/Component.java#L3066-L3070 >> >> >> Martin Grigorov >> Wicket Training and Consulting >> https://twitter.com/mtgrigorov >> >> >
