commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <rdon...@apache.org>
Subject [beanutils] Re: [Bug 17036] - PropertyUtils doesn't recognise "normal" properties on a DynaBean descendent object.
Date Thu, 27 Mar 2003 18:24:43 GMT
hi gavin

i think that commons-dev list is the best place to discuss this kind of 
thing. i'd recommend that you subscribe (so longer as you set up filters 
first since the volume's reasonably high) but if you don't, you can 
probably follow this thread by using the archives. you can post to list 
even if you're not subscribed, but the post will be moderated (and so may 
take a little time to make it through.

- robert

On Wednesday, March 26, 2003, at 11:13 PM, Gavin McPhee wrote:

> Hello Robert,
>
> Thanks for the effort that you went to with this.
> Having read the reply from Craig I agree with his evaluation of the 
> problem
> however I'd rather not use the reflection API myself for exactly the same
> reasons that he has indicated.
>
> What I'm after is a mechanism to access bean properties that are methods 
> and
> not just object instances (as is the current BasicDynaBean implementation)
> .
> As an example, I may wish to have a method such as public Long getUpTime(
> )
> (which has to calculate its result) and access this method from the
> PropertyUtils class.
> I believe that this could be done by creating a DynaBean implementation or
> modifying the BasicDynaBean implementation to allow for the registration 
> of
> a user defined getter and setter methods for individual properties. This
> mechanism would not break current implementations as Craig has outlined.
>
> I'd like to hear your thoughts on this.
>
> Regards,
> Gavin McPhee.
>
>
> -----Original Message-----
> From: bugzilla@apache.org [mailto:bugzilla@apache.org]
> Sent: Thursday, 27 March 2003 5:24 AM
> To: gavin@objectconnections.com
> Subject: DO NOT REPLY [Bug 17036] - PropertyUtils doesn't recognise
> "normal" properties on a DynaBean decendent object.
>
>
> DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
> RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
> <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17036>.
> ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
> INSERTED IN THE BUG DATABASE.
>
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17036
>
> PropertyUtils doesn't recognise "normal" properties on a DynaBean 
> decendent
> object.
>
> rdonkin@apache.org changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|REOPENED                    |RESOLVED
>          Resolution|                            |WONTFIX
>
>
>
> ------- Additional Comments From rdonkin@apache.org  2003-03-26
> 18:24 -------
> the consensus is that the current behaviour is correct. if you want to 
> call
> the
> real property on a DynaBean, the right way to do this is to add them
> explicitly.
>
> On Tuesday, March 25, 2003, at 11:56 PM, Craig R. McClanahan wrote:
>
>> On Tue, 25 Mar 2003, robert burrell donkin wrote:
>>
>> Date: Tue, 25 Mar 2003 23:12:56 +0000
>> From: robert burrell donkin <robertburrelldonkin@blueyonder.co.uk>
>> Reply-To: Jakarta Commons Developers List <commons-
>> dev@jakarta.apache.org>
>> To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
>> Subject: [beanutils] bug#17036 PropertyUtils doesn't recognise "normal"
>>    properties on a DynaBean
>>
>> PropertyUtils doesn't recognise "normal" properties on a DynaBean (see
>> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17036).
>>
>> can anyone think of any good reasons why i shouldn't change beanutils so
>> that normal properties are available if none of the dynabean properties
>> match?
>>
>
> Personally, I think that doing this would be *really* confusing.  Just for
> one example, consider how one determines the names of all the properties
> supported by a DynaBean instance:
>
>   DynaProperty properties[] = dynaBean.getDynaClass().getDynaProperties()
> ;
>
> In today's implementation, the set of properties you get back represents
> 100% of the set of things that can be manipulated via get() and set()
> calls -- and you will get IAE if you try them with any other name.  If you
> make the proposed change, that's no longer the case -- but it is hard to
> argue that we should synthesize DynaProperty instances for the "real" bean
> properties as well, because they are *not* dynamic properties.
>
> A second confusion relates to whether or not sets through the standard
> bean setter can be read by the dynamic getter, and vice versa:
>
>   dynaBean.set("foo", "bar");
>   dynaBean.setFoo("baz");
>   String whatDoYouGet = (String) dynaBean.get("foo");
>   // What do you get?
>
> Logically, you would want to require that this return "baz" -- but that
> means we would break every existing DynaBean implementation class that
> already exists.  If you don't require this, then it's going to lead to all
> sorts of bugs when users assume that it works that way.
>
> I don't like it.  If you want to manipulate the standard JavaBeans
> properties of a DynaBean implementation, you should just call them
> directly :-)  or else use reflection yourself.
>
> Craig
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message