T - The type of objects to check.public class NullCheckPredicate<T> extends java.lang.Object implements Predicate<T>
new NullCheckPredicate(true) creates a predicate
checking for null values, and new NullCheckPredicate(false)
creates one to check for values other than null.
Alternatively subclasses can overwrite matchesNonNullValue(Object),
in which case that determines the value for the non-null objects.| Modifier and Type | Field and Description |
|---|---|
private boolean |
nullValue |
| Constructor and Description |
|---|
NullCheckPredicate(boolean nullValue)
Creates a new predicate.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
matches(T object)
Returns true iff the given object matches the predicate.
|
protected boolean |
matchesNonNullValue(T object)
Can be overwritten to apply further checks for values that are not null.
|
public NullCheckPredicate(boolean nullValue)
nullValue - The value to return for null.public final boolean matches(T object)
Predicateprotected boolean matchesNonNullValue(T object)
object - The value to check. Not null.