I do have that, however, since it needs to know what property to call, it
looks like this:

c = new ReverseComparator( new BeanComparator( "customerName",
String.CASE_INSENSITIVE_ORDER ) )

This way you can just daisy chain the decorators in one line..  Also, I was
modeling it on ReverseComparator, which doesn't have a setComparator()...
However, if you would like, I don't mind adding it!  Might be good to add it
to ReverseComparator as well..

Any other suggestions are welcome!

Eric

-----Original Message-----
From: Henri Yandell [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 4:56 PM
To: Jakarta Commons Developers List
Subject: RE: [COLLECTIONS/BEANUTILS] Is there a comparator that can
dynami cally pick a method to call on a bean?



> > 2) All comparisions are string comparisons..  So when I
> > compare Bigdecimals
> > 2, 12, and 22, the orders is 12, 2, 22!  Do I need to hand in
> > another class
> > to cast the objects to?

BeanComparator should have a Comparator property.

ie) I'd do:

Comparator comp = new ComparableComparator();
comp = new BeanComparator(comp);

or setComparator(..);

It's the reason why ComparableComparator exists :) So I can easily pass it
into my BeanComparator.

Hen


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to