You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rajesh Kalluri <rk...@manduca.com> on 2002/07/12 16:55:26 UTC

BeanUtils.describe and BeanUtils.populate indexeed properties...

I saw a similar issue on the archive but did not see what the solution to
this was, so decided to ask the same question again.

Do BeanUtils.describe and BeanUtils.populate supposed to handle indexed
properties?

Suppose I have this JavaBean:

public class NameBean {
     private String[] name;

     public String[] getName() {
          return this.name;
     }
     public void setName(String[] name) {
          this.name = name;
     }
     public String getName(int index) {
          return this.name[index];
     }
     public void setName(int index, String name) {
          this.name[index] = name;
     }
}

     NameBean nameBean = new NameBean();
     nameBean.setName(new String[] {"John", "Paul", "Jack"});

     Map properties = BeanUtils.describe(nameBean);

I would expect the following code to return a Map containing:
name[0]="John", name[1]="Paul", name[2]="Jack"

but instead,

I get name="John".
Only the first element is considered.

regards

Rajesh


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>