commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From EP...@upstate.com
Subject RE: [BeanUtils] BeanComparator enhancement..
Date Mon, 02 Dec 2002 17:25:12 GMT
Terrific!

Well, if we are going to open the can of worms farthur, how about better
support for nulls..

I have CustomerBean that may have an associated EmployeeBean..  

Right now, if I compare customer bob with employee jane with customer john
with no employee, I get a class cast exception because you can't compare
customer.employee.name because john has no associated employee.  What I
would like is to have a null returned instead, because my comparator chain
has logic that says that null values in comparasion go to the end...

What do you think of this as well?  

For your request, it seems that you could have property names associated
with class types or something....  so "com.myco.customer", "id", and
"com.myco.order","customerId" would be the registered values...?


Eric

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Monday, December 02, 2002 11:38 AM
To: Jakarta Commons Developers List
Subject: Re: [BeanUtils] BeanComparator enhancement..


On Mon, 2 Dec 2002 EPugh@upstate.com wrote:

>
> Hi all,
>
> I want to be able to query my BeanComparator and get back it's embedded
> comparator.  What are peoples thoughts on adding a public method
> getComparator() to return the embedded comparator?
>
> Eric Pugh
>

Makes sense to me -- I've added this in nightly build 20021203.

On a side note, have you ever run into the situation where you'd like to
use a BeanComparator when the property name in the two beans wasn't the
same?  I'm thinking of a use case like CustomerBean that uses "id" for the
customer's identifier, and OrderBean which uses "customerId" instead.  It
might be interesting to support this sort of thing as well.

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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message