org.apache.commons.collections4.functors

## Class PredicateTransformer<T>

- java.lang.Object
- - org.apache.commons.collections4.functors.PredicateTransformer<T>

- All Implemented Interfaces:
    Serializable, Transformer<T,Boolean>

      public class PredicateTransformer<T>
      extends Object
      implements Transformer<T,Boolean>, Serializable

  Transformer implementation that calls a Predicate using the input object and then returns the result.
  Since:
    3.0
  Version:
    $Id: PredicateTransformer.java 1477798 2013-04-30 19:49:02Z tn $
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PredicateTransformer(Predicate<? super T> predicate)` Constructor that performs no validation.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Predicate<? super T>` | `getPredicate()` Gets the predicate.
    `static <T> Transformer<T,Boolean>` | `predicateTransformer(Predicate<? super T> predicate)` Factory method that performs validation.
    `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`

- - ### 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,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:
        `IllegalArgumentException` - if the predicate is null

    - #### transform

          public Boolean transform(T input)

      Transforms the input to result by calling a predicate.
      Specified by:
        `transform` in interface `Transformer<T,Boolean>`
      Parameters:
        `input` - the input object to transform
      Returns:
        the transformed result

    - #### getPredicate

          public Predicate<? super T> getPredicate()

      Gets the predicate.
      Returns:
        the predicate
      Since:
        3.1

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.