public final class OnePredicate extends Object implements Predicate, PredicateDecorator, Serializable
NOTE: In versions prior to 3.2 an array size of zero or one threw an exception.
Constructor and Description |
---|
OnePredicate(Predicate[] predicates)
Constructor that performs no validation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
evaluate(Object object)
Evaluates the predicate returning true if only one decorated predicate
returns true.
|
static Predicate |
getInstance(Collection predicates)
Factory to create the predicate.
|
static Predicate |
getInstance(Predicate[] predicates)
Factory to create the predicate.
|
Predicate[] |
getPredicates()
Gets the predicates, do not modify the array.
|
public OnePredicate(Predicate[] predicates)
getInstance
if you want that.predicates
- the predicates to check, not cloned, not nullpublic static Predicate getInstance(Predicate[] predicates)
If the array is size zero, the predicate always returns false. If the array is size one, then that predicate is returned.
predicates
- the predicates to check, cloned, not nullany
predicateIllegalArgumentException
- if the predicates array is nullIllegalArgumentException
- if any predicate in the array is nullpublic static Predicate getInstance(Collection predicates)
predicates
- the predicates to check, cloned, not nullone
predicateIllegalArgumentException
- if the predicates array is nullIllegalArgumentException
- if any predicate in the array is nullpublic boolean evaluate(Object object)
public Predicate[] getPredicates()
getPredicates
in interface PredicateDecorator
Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.