commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Eickvonder <b.ei...@gmx.net>
Subject collections.list.LazyList set method
Date Wed, 13 Jul 2005 21:49:34 GMT
Hello,

I use a LazyList within a bean to store indexed properties, having only a
"getList()" and a "setList(list)" method. This works fine as long as I only
set nested properties of the indexed property, i.e. setting something like
list[0].attribute.
But if I try to set the indexed property itself by e.g.
"PropertyUtils.setProperty(bean, "list[0]", "val0")" out of the beanutils
package I get an ArrayIndexOutOfBounds because in the end this call uses the
set-method of the underlying list.
So my suggestion would be to slightly extend the LazyList by overwriting the
set-method (defined in List) in the following way

    public Object set(int index, Object obj) {
      if (index>=size()) get(index);
      return super.set(index, obj);
    }

What do you think about this idea?

Bjoern Eickvonder

____________
Virus checked by G DATA AntiVirusKit
Version: AVK 15.0.6045 from 13.07.2005


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message