commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [beanutils] bug#17036 PropertyUtils doesn't recognise "normal" properties on a DynaBean
Date Tue, 25 Mar 2003 23:56:34 GMT


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.

> - robert

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