Class PredicateTransformer<T>

  • Type Parameters:
    T - the type of the input and result to the function.
    All Implemented Interfaces:
    java.io.Serializable, java.util.function.Function<T,​java.lang.Boolean>, Transformer<T,​java.lang.Boolean>

    public class PredicateTransformer<T>
    extends java.lang.Object
    implements Transformer<T,​java.lang.Boolean>, java.io.Serializable
    Transformer implementation that calls a Predicate using the input object and then returns the result.
    Since:
    3.0
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      PredicateTransformer​(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> getPredicate()
      Gets the predicate.
      static <T> Transformer<T,​java.lang.Boolean> predicateTransformer​(Predicate<? super T> predicate)
      Factory method that performs validation.
      java.lang.Boolean transform​(T input)
      Transforms the input to result by calling a predicate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Function

        andThen, compose
      • Methods inherited from interface org.apache.commons.collections4.Transformer

        apply
    • Constructor Detail

      • PredicateTransformer

        public PredicateTransformer​(Predicate<? super T> predicate)
        Constructor that performs no validation. Use predicateTransformer if you want that.
        Parameters:
        predicate - the predicate to call, not null
    • Method Detail

      • predicateTransformer

        public static <T> Transformer<T,​java.lang.Boolean> predicateTransformer​(Predicate<? super T> predicate)
        Factory method that performs validation.
        Type Parameters:
        T - the input type
        Parameters:
        predicate - the predicate to call, not null
        Returns:
        the predicate transformer
        Throws:
        java.lang.IllegalArgumentException - if the predicate is null
      • getPredicate

        public Predicate<? super TgetPredicate()
        Gets the predicate.
        Returns:
        the predicate
        Since:
        3.1
      • transform

        public java.lang.Boolean transform​(T input)
        Transforms the input to result by calling a predicate.
        Specified by:
        transform in interface Transformer<T,​java.lang.Boolean>
        Parameters:
        input - the input object to transform
        Returns:
        the transformed result