org.apache.commons.collections.functors
Class PredicateTransformer<T>

java.lang.Object
  extended by org.apache.commons.collections.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 input.

Since:
Commons Collections 3.0
Version:
$Revision: 1.1.1.1 $ $Date: 2005/05/23 04:34:35 $
Author:
Matt Hall, John Watkinson, Stephen Colebourne
See Also:
Serialized Form

Constructor Summary
PredicateTransformer(Predicate<T> predicate)
          Constructor that performs no validation.
 
Method Summary
static
<T> Transformer<T,Boolean>
getInstance(Predicate<T> predicate)
          Factory method that performs validation.
 Predicate<T> getPredicate()
          Gets the predicate.
 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<T> predicate)
Constructor that performs no validation. Use getInstance if you want that.

Parameters:
predicate - the predicate to call, not null
Method Detail

getInstance

public static <T> Transformer<T,Boolean> getInstance(Predicate<T> predicate)
Factory method that performs validation.

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<T> getPredicate()
Gets the predicate.

Returns:
the predicate
Since:
Commons Collections 3.1


Copyright © 2005-2005 Apache Software Foundation, Matt Hall, John Watkinson. All Rights Reserved.