Martin,

To me throwing an exception if the best way to indicate that you haven't
set a model for component and that you are trying to store something on
something that does not exists. Otherwise sloppy users might just
"accidentally" serialize large "business objects" without noticing.

On Thu, Apr 21, 2016 at 10:11 AM, Martin Grigorov <[email protected]>
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
>



-- 
Regards - Ernesto Reinaldo Barreiro

Reply via email to