BeanUtils works correctly in that if you want to set against an index, 
you can have the following forms.

Quoted from the bean spec --==>>

void setter(int index, PropertyType value); // indexed setter
PropertyType getter(int index);             // indexed getter

void setter(PropertyType values[]);         // array setter
PropertyType[] getter();                    // array getter

...so it's either setting and getting an entire array collection, or 
directly setting and getting objects against an index which can mean 
absolutely anything internally to the bean. The BeanUtils class uses 
separate code blocks to handle both.

Builds as of a few days ago will accept implementations of 
java.util.List as well as the primitive arrays the spec defines.

I think the ones you're after are the array methods.

Arron.

>It appears there is a bug in BeanUtils.populate() for an indexed setter
>of array type.  It doesn't take into account that it is an indexed
>setter and that the second parameter is an array because it only checks
>the first parameter which is always an int for an indexed setter.  This
>is the code in the 1.0.1 release:
> 
>           ...
>            Class parameterType = parameterTypes[0];
>            if (parameterTypes.length > 1)
>                parameterType = parameterTypes[1];      // Indexed
>setter
>            // Convert the parameter value as required for this setter
>method
>            Object parameters[] = new Object[1];
>            if (parameterTypes[0].isArray()) {
>          ...
> 
>it should be as follows:
> 
>           ...
>            Class parameterType = parameterTypes[0];
>            if (parameterTypes.length > 1)
>                parameterType = parameterTypes[1];      // Indexed
>setter
>            // Convert the parameter value as required for this setter
>method
>            Object parameters[] = new Object[1];
>            if (parameterType.isArray()) {
>          ...
> 
>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to