Niall,
What looks pretty clear is that YOU do not know what he is talking about.
On caching: he is only talking about caching introspection information, not the actual beans.
Go and study what the DynaBean/DynaClass implementations are all about. Do your home work if you really care about them.
Regards, Paulo Gaspar
Niall Pemberton wrote:
Maybe you could spell out the issues with PropertyUtils and DynaBeans and the methods involved and what you're trying to do because its not clear what your trying to resolve.
I'm don't see much value in the getDynaProperties() method being in PropertyUtils - all you need to do is make eveything a DynaBean then you can get the DynaProperties and do whatever you want using the existing DynaBean/DynaClass methods - no need for PropertyUtils at all.
DynaBean dynaBean = (bean instanceof DynaBean) ? (DynaBean)bean : new WrapDynaBean(bean);
For caching to work people are going to have to change how they create DynaBeans and I believe its better left up to the environment they're being used in to implement a caching mechanism - Struts does this for its DynaActionForm implementation.
Niall
----- Original Message ----- From: "Kris Nuttycombe" <[EMAIL PROTECTED]>
To: "Commons Developers Jakarta" <[EMAIL PROTECTED]>
Sent: Saturday, December 04, 2004 12:55 AM
Subject: [beanutils] PropertyUtils & DynaBeans
Hi, all,
As it currently stands, PropertyUtils doesn't support DynaBeans for a number of its methods. It doesn't make much sense to return PropertyDescriptors for DynaBeans, but it's no great pain to use WrapDynaClass on an ordinary class and thereby be able to introspect either regular beans or DynaBeans using the same interface. To support this, I'd like to add a method with the signature:
DynaProperty[] getDynaProperties(Object bean)
to PropertyUtilsBean, with a corresponding static method in PropertyUtils.
Now, one of the other advantages of using PropertyUtilsBean is that it caches the introspected data. Conceivably, this would also be a useful feature for the getDynaProperties method. However, here we have a problem: since DynaClass doesn't have any way to enforce that its implementations implement HashCode, there's no way to use the same map caching strategy as is used for the PropertyDescriptors. This illustrates a larger issue, which is that DynaClass objects aren't singletons like Class objects are.
To resolve this, I propose adding an AbstractDynaClass base class that implements hashCode() and equals() based upon the public methods available in DynaClass. This way, even if DynaClasses aren't singletons, they can be used for hash keys. It might be also useful to implement a registry for DynaClasses in this abstract class to provide singleton-like functionality. Existing DynaClass implementations would be modified to extend AbstractDynaClass.
Any thoughts?
Kris
--------------------------------------------------------------------- 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]
