commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Caswell" <ste...@caswell.name>
Subject RE: [beanutils] extending BasicDynaBean with toString, equals, and hashCode
Date Thu, 12 Jun 2003 22:33:32 GMT
My use of the lang.builder is in fact the non-reflection part. I simply look
at the dynabean's dynaclass, ask it for the array of dyna properties, then
step through the array and call gets on the dynabean for each property,
passing the result to the appropriate builder.

I understand any hesitancy to add an external dependency without good
reason. Of course IMHO, adding a dependency to lang would be appropriate
here because of the benefits of having this basic functionality encapsulated
in the lang.builder package. While the implementation of toString and equals
could be redone without lang.builder, it would be more work (which would be
more error-proned) to do a hashCode implementation in a similar manner. I
think it would be a shame to waste the great effort of the lang folks who
put together the lang.builder package.

I use many of the pieces on a daily basis, esp. the lang.builder stuff. IMHO
it is pretty solid, so I think the risk to beanutils of a dependency on lang
would be minimal.


Steven Caswell
steven@caswell.name
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: Christoph.Reck@dlr.de [mailto:Christoph.Reck@dlr.de] 
> Sent: Thursday, June 05, 2003 3:08 AM
> To: Jakarta Commons Developers List
> Subject: Re: [beanutils] extending BasicDynaBean with 
> toString, equals, and hashCode
> 
> 
> The concept of ToStringBuilder and EqualsBuilder ist good, 
> but not completely suited for BeanUtils - the reflection 
> pattern used does not consider the accessor methods for beans.
> 
> If your extended dynabean does the explicit use of the 
> lang.builder code w/o the reflection parts, it should suite 
> the bean use pattern. A dependency of beanutils on lang will 
> need acceptance voting from the committers (to me seems to be 
> OK, since lang is even lower level than beans).
> 
> It might be sensible to factor out parts from the 
> lang.builder implementations to be then subclassed once for 
> beans and once for full filed reflection usage?
> 
> Just my 2c!
> 
> Craig R. McClanahan wrote:
> > 
> > On Tue, 3 Jun 2003, Steven Caswell wrote:
> > 
> > 
> >>Date: Tue, 3 Jun 2003 20:32:26 -0400
> >>From: Steven Caswell <steven@caswell.name>
> >>Reply-To: Jakarta Commons Developers List 
> <commons-dev@jakarta.apache.org>,
> >>     steven@caswell.name
> >>To: Jakarta Commons Developers List <commons-dev@jakarta.apache.org>
> >>Subject: [beanutils] extending BasicDynaBean with toString, equals,
> >>     and hashCode
> >>
> >>I've written an extended dynabean class that extends 
> (actually, wraps) 
> >>BasicDynaBean to add toString and equals. The toString method uses 
> >>commons.lang.ToStringBuilder to build the toString, and 
> >>commons.lang.EqualsBuilder to perform the equals 
> comparison. I know it 
> >>needs hashCode, I just haven't taken the time to add it yet.
> >>
> >>Is there any interest in having this class donated to 
> >>commons-beanutils?
> >>
> > 
> > 
> > Conceptually, I like the idea.  My only concern is that it would 
> > introduce a dependency on commons-lang that does not 
> currently exist 
> > in beanutils.
> > 
> > 
> >>Steven Caswell
> > 
> > 
> > Craig
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > 
> > 
> 
> -- 
> :) Christoph Reck
> 
> 



---------------------------------------------------------------------
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