Johan,
good catch. Makes sense
+1
Juergen
On Wed, 01 Dec 2004 12:00:39 +0100, Johan Compagner <[EMAIL PROTECTED]> wrote:
> we have these 2 methods:
>
> protected ListItem newItem(final int index)
> {
> Object model = getListObject(index);
> if (!(model instanceof Serializable))
> {
> throw new IllegalArgumentException("ListView and ListItem
> model data must be serializable");
> }
>
> return new ListItem(index, this);
> }
>
> protected Serializable getListObject(final int index)
> {
> return (Serializable) getList().get(index);
> }
>
> But the first with the check for instanceof will never be reached
> because the getListObject already tries to cast it
> i would vote to change it this way:
>
> protected ListItem newItem(final int index)
> {
> Object model = getListObject(index);
> return new ListItem(index, this);
> }
>
> protected Serializable getListObject(final int index)
> {
> Object object = getList().get(index);
> if (!(object instanceof Serializable))
> {
> throw new IllegalArgumentException("ListView and ListItem
> model data must be serializable, data: " + object );
> }
> return (Serializable) object;
> }
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Wicket-develop mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Wicket-develop mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/wicket-develop