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: [Design Discussion] DynaBeans - Dynamic Proxy
Date Fri, 28 Dec 2001 16:11:32 GMT
On Fri, 28 Dec 2001, Rey Francois wrote:

> Date: Fri, 28 Dec 2001 16:46:22 +0100
> From: Rey Francois <Francois.Rey@capco.com>
> Reply-To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> To: 'Jakarta Commons Developers List' <commons-dev@jakarta.apache.org>
> Subject: RE: [Design Discussion] DynaBeans - Dynamic Proxy
>
> -----Original Message Extract-----
> From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> Sent: 25 December 2001 00:52
> To: commons-dev@jakarta.apache.org
> Subject: [Design Discussion] DynaBeans - Round 2
>  (...)
>
>
> Proposed Next Steps (Once Design Is Agreed Upon):
>
>
> (4) Implement "proxy" DynaClass and DynaBean wrappers around standard
>     JavaBeans.  (This sounds sort of backwards, but allows an application
>     to be written *totally* in terms of DynaBeans if desired.)
>
> (5) Implement a convenient way to convert a java.sql.ResultSet (or RowSet)
>     into a series of DynaBeans, where the corresponding DynaClass is
>     synthesized based on the metadata of the result set.
>
> -----End of Original Message Extract-----
>
> About the two items above, I'm wondering if we cannot implement them using
> the dynamic proxy API introduced in J2SE 1.3 (see
> http://java.sun.com/j2se/1.3/docs/guide/reflection/proxy.html). I'm not
> clear yet on what would be the benefits of such approach, as I'm just
> recently discovering this API...
>
> Has anybody further thoughts on this?
>

My take is this ... once you start dealing with properties in a dynamic
way, you want to be able to treat *everything* that way (from a
programming API perspective) in some circumstances.  In the case of
DynaBeans, the programming APIs you use to retrieve a property (for
example) are different than standard JavaBeans:

  String foo = regularBean.getFoo();

versus

  String foo = dynaBean.get("foo");

which can be pretty annoying.  Sometimes, I'd like to be able to program
everything as if it's a DynaBean, even if it is a standard JavaBean
underneath.  A proxy DynaBean class that simply wraps standard JavaBeans
in the DynaBean APIs lets you hve this luxury.

  ProxyDynaBean dynaBean = new ProxyDynaBean(regularBean);
  String foo = dynaBean.get("foo");

> Fr.

Craig


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


Mime
View raw message