commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joachim Gjesdal <joachim.gjes...@ecomda.com>
Subject Noticed all the requests about dynamic properties?
Date Wed, 07 Nov 2001 19:19:38 GMT
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


Mime
View raw message