commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Eckenfels <e...@zusammenkunft.net>
Subject Re: commons-lang pull request: add isNull and isNotNull methods
Date Tue, 04 Feb 2014 20:20:24 GMT
Hello,

I agree, for a simple "isNull(Object)" predicate, this is really an anti
pattern. I can understand validate() methods which throw a application
specific cleaned up exception and do some logging and stuff. But this
is nothing for a external dependency.

This is different from isEmpty(String) because that has more code (check
for null, trim, etc).

Gruss
Bernd


 Am Tue, 04 Feb 2014 12:08:13 -0800
schrieb Adrian Crum <adrian.crum@sandglass-software.com>:

> Personally, I view this as an anti-pattern. You have a null reference
> in your hand, and instead of checking the reference that is in your
> hand, you give it to an unrelated class and have that class check to
> see if it is a null reference. That just doesn't make any sense to me.
> 
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
> 
> On 2/4/2014 12:02 PM, otaviojava wrote:
> > GitHub user otaviojava opened a pull request:
> >
> >      https://github.com/apache/commons-lang/pull/16
> >
> >      add isNull and isNotNull methods
> >
> >      Sugestion to add two simple and useful methods, with tests, on
> > ObjectsUtil to get the code cleaner. isnull and isNotNull. So you
> > can use if (ObjectUtil.isNull(value)) instead of if (value == null)
> > the goal is the code more understandable.
> >
> >
> > You can merge this pull request into a Git repository by running:
> >
> >      $ git pull https://github.com/otaviojava/commons-lang trunk
> >
> > Alternatively you can review and apply these changes as the patch
> > at:
> >
> >      https://github.com/apache/commons-lang/pull/16.patch
> >
> > ----
> > commit 4f4d5b8eecdc61f22363d9d9883626549c12564a
> > Author: otaviojava <otaviojava@java.net>
> > Date:   2014-02-04T19:58:43Z
> >
> >       add two simple and useful methods, with tests, on ObjectsUtil
> > to get the code cleaner. isnull and isNotNull.
> >
> > ----
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


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


Mime
View raw message