You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <ba...@generationjava.com> on 2003/12/31 21:28:26 UTC
[beanutils] BeanComparator wrapping NullComparator?
Currently BeanComparator will fall over on a null, as
'testCompareWithNulls' unit test shows.
Is there a lot of objection to making it more user friendly and making it
wrap NullComparator instead of ComparableComparator so that nulls do not
break?
[NullComparator wraps ComparableComparator by default].
Hen
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [beanutils] BeanComparator wrapping NullComparator?
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
i think i'd expect the default implementation to gracefully cope with
null's. null's first or nulls last is an arbitrary choice and most
users would probably prefer to accept this than null. i suspect that
there may be some wrinkles making this work properly.
- robert
On 31 Dec 2003, at 21:07, Henri Yandell wrote:
>
> Dunno. If I supply my own Comparator to BeanComparator, I think it's
> up to
> me as to whether it blows up. "No magic".
>
> For the first/last question, it's easy. Use whathever NullComparator
> does
> by default. Someone is always free to specify NullComparator(true) as a
> comparator to beancomparator.
>
> Or they can specify ComparableComparator as an argument to make Null's
> blow, but I reckon the average user will want the gentlest choices to
> be
> made, without restricting their option to choose otherwise.
>
> Hen
>
> On Wed, 31 Dec 2003, Tim O'Brien wrote:
>
>> I know that some have objected to this in the past, but I think this
>> is a
>> good idea.
>>
>> I think that BeanComparator should work with nulls
>> "out-of-the-box" the question arises - are nulls first or last?
>> There is
>> an old issue that deals with this:
>> http://issues.apache.org/bugzilla/show_bug.cgi?id=18791
>>
>> I'm of the opinion that it isn't necessarily straightforward to wrap
>> NullComparator. I think people expect BeanComparator *not* to blow
>> up on
>> a null property value, and it would be generally easy to implement.
>>
>> Tim
>>
>>
>> On Wed, 31 Dec 2003, Henri Yandell wrote:
>>
>>>
>>> Currently BeanComparator will fall over on a null, as
>>> 'testCompareWithNulls' unit test shows.
>>>
>>> Is there a lot of objection to making it more user friendly and
>>> making it
>>> wrap NullComparator instead of ComparableComparator so that nulls do
>>> not
>>> break?
>>>
>>> [NullComparator wraps ComparableComparator by default].
>>>
>>> Hen
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>>
>>>
>>>
>>
>> --
>> ----------------------
>> Tim O'Brien
>> Evanston, IL
>> (847) 863-7045
>> tobrien@discursive.com
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [beanutils] BeanComparator wrapping NullComparator?
Posted by Henri Yandell <ba...@generationjava.com>.
Dunno. If I supply my own Comparator to BeanComparator, I think it's up to
me as to whether it blows up. "No magic".
For the first/last question, it's easy. Use whathever NullComparator does
by default. Someone is always free to specify NullComparator(true) as a
comparator to beancomparator.
Or they can specify ComparableComparator as an argument to make Null's
blow, but I reckon the average user will want the gentlest choices to be
made, without restricting their option to choose otherwise.
Hen
On Wed, 31 Dec 2003, Tim O'Brien wrote:
> I know that some have objected to this in the past, but I think this is a
> good idea.
>
> I think that BeanComparator should work with nulls
> "out-of-the-box" the question arises - are nulls first or last? There is
> an old issue that deals with this:
> http://issues.apache.org/bugzilla/show_bug.cgi?id=18791
>
> I'm of the opinion that it isn't necessarily straightforward to wrap
> NullComparator. I think people expect BeanComparator *not* to blow up on
> a null property value, and it would be generally easy to implement.
>
> Tim
>
>
> On Wed, 31 Dec 2003, Henri Yandell wrote:
>
> >
> > Currently BeanComparator will fall over on a null, as
> > 'testCompareWithNulls' unit test shows.
> >
> > Is there a lot of objection to making it more user friendly and making it
> > wrap NullComparator instead of ComparableComparator so that nulls do not
> > break?
> >
> > [NullComparator wraps ComparableComparator by default].
> >
> > Hen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
> >
>
> --
> ----------------------
> Tim O'Brien
> Evanston, IL
> (847) 863-7045
> tobrien@discursive.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [beanutils] BeanComparator wrapping NullComparator?
Posted by Tim O'Brien <to...@discursive.com>.
I know that some have objected to this in the past, but I think this is a
good idea.
I think that BeanComparator should work with nulls
"out-of-the-box" the question arises - are nulls first or last? There is
an old issue that deals with this:
http://issues.apache.org/bugzilla/show_bug.cgi?id=18791
I'm of the opinion that it isn't necessarily straightforward to wrap
NullComparator. I think people expect BeanComparator *not* to blow up on
a null property value, and it would be generally easy to implement.
Tim
On Wed, 31 Dec 2003, Henri Yandell wrote:
>
> Currently BeanComparator will fall over on a null, as
> 'testCompareWithNulls' unit test shows.
>
> Is there a lot of objection to making it more user friendly and making it
> wrap NullComparator instead of ComparableComparator so that nulls do not
> break?
>
> [NullComparator wraps ComparableComparator by default].
>
> Hen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
--
----------------------
Tim O'Brien
Evanston, IL
(847) 863-7045
tobrien@discursive.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org