public final class OnePredicate extends java.lang.Object implements Predicate, PredicateDecorator, java.io.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(java.lang.Object object)
Evaluates the predicate returning true if only one decorated predicate
returns true.
|
static Predicate |
getInstance(java.util.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
predicatejava.lang.IllegalArgumentException
- if the predicates array is nulljava.lang.IllegalArgumentException
- if any predicate in the array is nullpublic static Predicate getInstance(java.util.Collection predicates)
predicates
- the predicates to check, cloned, not nullone
predicatejava.lang.IllegalArgumentException
- if the predicates array is nulljava.lang.IllegalArgumentException
- if any predicate in the array is nullpublic boolean evaluate(java.lang.Object object)
public Predicate[] getPredicates()
getPredicates
in interface PredicateDecorator
Copyright © 2010 - 2020 Adobe. All Rights Reserved