On 6/1/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
On Thu, June 1, 2006 3:32 pm, Craig McClanahan wrote:
>> Not sure what's going on... since this is the version of
>> setIndexedProperty() without the index, I assume it's going to call
>> setChildren(List) and not be looking for the setter with the index,
>> correct? Thanks!
>
>
> Correct. It's a limitation of BeanUtils that it does not try to use the
> "indexed" setters if they exist. It only deals with the actual List or
> array property as a whole.
Excellent, thanks again! If you'll permit me one last question? :)
I have a String[] field "certs" on the bean I'm populating, and I have a
List in the object trying to populate it. I've tried:
PropertyUtils.setProperty(obj, "certs", ((List)fieldValues).toArray());
...but that gets me a java.lang.IllegalArgumentException: argument type
mismatch. How does one populate an array? And specifically, from a List?
I guess the setCerts(String[] vals) method doesn't match up with the
Object[] that toArray() returns...
<snip/>
Have you tried:
((List)fieldValues).toArray(new String[0])
which offers control over the runtime type of the returned array, here
an array of Strings?
-Rahul
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]