You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Joachim Gjesdal <jo...@ecomda.com> on 2001/11/07 20:19:38 UTC

Noticed all the requests about dynamic properties?

Looks like you guys are a bit reluctant to tangle this issue??

I posted some comments about PropertyUtils a while ago on this list, but
they where ignored so I thought there were no interest. However it seems
like the community of struts developers needs the feature.

I changed PropertyUtils for my needs, but this class stll needs some
major refactoring (I think).

Here are my comments:

MappedProperties are ok for dynamic properties.

The BeanInfo mechanism cannot be used to determine the if the property
is a MappedProperty, introspection works differently (Introspection does
not allow getProperty methods with arguments and it will anyway always
return descriptors of type PropertyDescriptor).

PropertyUtils logic should be based on the properties descriptor type,
not the if there are parentheses or other delimiters around the
properties.

Either provide a interface with the getPropertyDescriptors method that
can be extended by the dynamic form bean (the Sorensen way) or just use
reflection to get the descriptors from the bean.
(I chose the last alternative since this meant changing only this one
class).

Changes are

1 .Method getPropertyDescriptor uses reflection to get the bean's
property descriptors
2.Because the logic of PropertyUtils is based on the delimiter notation,
the mapped properties now looks like simple properties. I had to
slightly change set/getSimpleProperty(...). I know its a little hack,
but it shows the idea. (and I could leave the rest of my code unchanged
after upgrading to Struts 1.1)


source attached

...or maybe I got it all wrong and dynamic properites works like a dream
in current version???

joachim