Class TransformedPredicate<T>
java.lang.Object
org.apache.commons.collections4.functors.TransformedPredicate<T>
- All Implemented Interfaces:
Serializable
,Predicate<T>
,PredicateDecorator<T>
,Predicate<T>
public final class TransformedPredicate<T>
extends Object
implements PredicateDecorator<T>, Serializable
Predicate implementation that transforms the given object before invoking
another
Predicate
.- Since:
- 3.1
- See Also:
-
Constructor Summary
ConstructorDescriptionTransformedPredicate
(Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) Constructor that performs no validation. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Evaluates the predicate returning the result of the decorated predicate once the input has been transformedGets the predicate being decorated.Transformer<? super T,
? extends T> Gets the transformer in use.static <T> Predicate<T>
transformedPredicate
(Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) Factory to create the predicate.
-
Constructor Details
-
TransformedPredicate
public TransformedPredicate(Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) Constructor that performs no validation. UsetransformedPredicate
if you want that.- Parameters:
transformer
- the transformer to usepredicate
- the predicate to decorate
-
-
Method Details
-
transformedPredicate
public static <T> Predicate<T> transformedPredicate(Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) Factory to create the predicate.- Type Parameters:
T
- the type that the predicate queries- Parameters:
transformer
- the transformer to callpredicate
- the predicate to call with the result of the transform- Returns:
- the predicate
- Throws:
NullPointerException
- if the transformer or the predicate is null
-
evaluate
Evaluates the predicate returning the result of the decorated predicate once the input has been transformed -
getPredicates
Gets the predicate being decorated.- Specified by:
getPredicates
in interfacePredicateDecorator<T>
- Returns:
- the predicate as the only element in an array
- Since:
- 3.1
-
getTransformer
Gets the transformer in use.- Returns:
- the transformer
-