hello

i can see the usefulness of this code in some particular cases but i'm not very keen on it's inclusion in a general library (at least in it's current form).

arrays are dealt with by beanutils as part of more general indexed properties. PropertyUtils.setIndexedProperty allows entries in arrays to be set but does not expand the arrays. i think that allowing setIndexedProperty to expand arrays would risk confusion: for example, would you only expand the array if the index was one more than the current size - or would you add sufficient null entries?

on the other hand, this is IMHO too specific an issue to warrant the addition of an extra method into what is a general library.

of course, other people might feel differently.

- robert

On Thursday, March 20, 2003, at 09:20 AM, Mingfai Ma wrote:

hi,

I wonder whether you think it is a useful feature for BeanUtils
(PropertyUtils) to do the following:

(when setting a value, detect if the property is an array)
1. if the property is an array and is not constructed and initialized,
construct one and have the new value add to the last slot.

2. if the array property is not null, check if there is any empty slot (
null). set value to the last empty slot.

3. if the array property is not null, and is full, expand it by one and set
the value to the last (expanded) slot.


Attached is the code that does this at the outside of BeanUtils. If you
think it's useful, I can clean the code up and put into the PropertyUtils
and submit a patch.

I guess it may be a bad practice to do so, and there will be performance
drawback. So, a flag should be there to enable the feature.

(btw, let me know if such method is existed already!)

Regards,
mingfai


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


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



Reply via email to