Class TransformedPredicate<T>
- java.lang.Object
-
- org.apache.commons.collections4.functors.AbstractPredicate<T>
-
- org.apache.commons.collections4.functors.TransformedPredicate<T>
-
- Type Parameters:
T- the type of the input to the predicate.
- All Implemented Interfaces:
java.io.Serializable,java.util.function.Predicate<T>,PredicateDecorator<T>,Predicate<T>
public final class TransformedPredicate<T> extends AbstractPredicate<T> implements PredicateDecorator<T>, java.io.Serializable
Predicate implementation that transforms the given object before invoking anotherPredicate.- Since:
- 3.1
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TransformedPredicate(Transformer<? super T,? extends T> transformer, Predicate<? super T> predicate)Constructor that performs no validation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Predicate<? super T>[]getPredicates()Gets the predicate being decorated.Transformer<? super T,? extends T>getTransformer()Gets the transformer in use.booleantest(T object)Evaluates the predicate returning the result of the decorated predicate once the input has been transformedstatic <T> Predicate<T>transformedPredicate(Transformer<? super T,? extends T> transformer, Predicate<? super T> predicate)Creates the predicate.-
Methods inherited from class org.apache.commons.collections4.functors.AbstractPredicate
evaluate
-
-
-
-
Constructor Detail
-
TransformedPredicate
public TransformedPredicate(Transformer<? super T,? extends T> transformer, Predicate<? super T> predicate)
Constructor that performs no validation. UsetransformedPredicateif you want that.- Parameters:
transformer- the transformer to usepredicate- the predicate to decorate
-
-
Method Detail
-
transformedPredicate
public static <T> Predicate<T> transformedPredicate(Transformer<? super T,? extends T> transformer, Predicate<? super T> predicate)
Creates 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:
java.lang.NullPointerException- if the transformer or the predicate is null
-
getPredicates
public Predicate<? super T>[] getPredicates()
Gets the predicate being decorated.- Specified by:
getPredicatesin interfacePredicateDecorator<T>- Returns:
- the predicate as the only element in an array
- Since:
- 3.1
-
getTransformer
public Transformer<? super T,? extends T> getTransformer()
Gets the transformer in use.- Returns:
- the transformer
-
-