commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ola Berg <>
Subject [pattern][PATCH] Null is illegal, null is false
Date Fri, 09 Aug 2002 08:49:58 GMT
Q: What is the correct behaviour for a Predicate when you try to evaluate null objects?

A: Depends on the particular Predicate. But if you want
to assert certain behaviour from any Predicate, I suggest you use these fine new decorating
methods in PredicateUtils:

//p1 will throw a NullPointerException for every evaluated null
Predicate p1 = PredicateUtils.nullIsIllegal( predicate);

//p2 will return false for every evaluated null
Predicate p2 = PredicateUtils.nullIsFalse( predicate);

//p3 will return true for every evaluated null
Predicate p3 = PredicateUtils.nullIsTrue( predicate);

The attached file contains these three methods with their inner classes for inclusion in PredicateUtils,
if they would be regarded useful.

No it is not a proper patch, just some copy-paste-code.


0733 - 99 99 17
View raw message