From what I understand, the property descriptor really handles the 
straight invocation of a bean property, not getting a hold of a 
collection and using it. For example, the IndexedPropertyDescriptor 
won't get back the Object[] and then get the object from the index, it 
only takes the "Object getMyProperty(index)" style property methods.

If you look at the indexed part of PropertyUtils, handling the Object[] 
is the special case outside of the descriptor. Through this we're also 
getting an item from a java.util.List implementation.

Similar to all that is the MappedPropertyDescriptor.

PropertyUtils/BeanUtils was apparently meant to be an implementation of 
the Bean spec (though I don't see mapped properties in the bean spec :), 
and to carry it out seems that these collection type uses need to be 
manually handled. Use PropertyUtils and you'll get at your Lists.

Arron.

Stephen Colebourne wrote:

>I've just spent the evening trying to figure out the property descriptor
>classes myself. For the joda project I wanted to return a BeanInfo
>specifying a description of the bean. But it seems to be a bit tricky.
>
>PropertyDescriptor is OK for my needs (just about)
>IndexedPropertyDesciptor is not much use as it only covers arrays, not Lists
>MappedPropertyDescriptor seems to be of limited use. It is picked up from
>BeanInfo, but does not include the Map getXxxMap() type method as Arron
>noted.
>
>Nothing really handles Lists, and I also noted that DynaBeans don't use
>PropertyDescriptors.
>
>One solution would be for beanutils to have a ListPropertyDescriptor that
>copes with getXxxList() and getXxx(int). Plus extending
>MappedPropertyDescriptor to cover getXxxMap().
>
>This all seems hard work however. The beans spec is pretty outdated these
>days (thats why I started joda really). My question is whether these
>extended (ie. java.beans) PropertyDescriptor classes really are that
>useful - can they really be used as general purpose classes without writing
>a full replacement to java.beans.Introspector?
>




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

Reply via email to