Top Description Fields Constructors Methods
org.apache.commons.collections4.functors

public Class PredicateTransformer<T>

extends Object
implements Transformer<T, Boolean>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.collections4.Transformer
Imports
java.io.Serializable, org.apache.commons.collections4.Predicate, .Transformer

Transformer implementation that calls a Predicate using the input object and then returns the result.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final Predicate<? super T>
iPredicate

The closure to wrap

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
public
PredicateTransformer(final Predicate<? super T>
the predicate to call, not null
predicate
)

Constructor that performs no validation.

Method Summary

Modifier and TypeMethod and Description
public Predicate<? super T>

Returns:

the predicate
getPredicate
()

Gets the predicate.

public static <
the input type
T
>
Transformer<T, Boolean>

Returns:

the predicate transformer
predicateTransformer
(final Predicate<? super T>
the predicate to call, not null
predicate
)

Factory method that performs validation.

public Boolean

Returns:

the transformed result
transform
(final T
the input object to transform
input
)

Implements org.apache.commons.collections4.Transformer.transform.

Transforms the input to result by calling a predicate.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iPredicateback to summary
private final Predicate<? super T> iPredicate

The closure to wrap

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

PredicateTransformerback to summary
public PredicateTransformer(final Predicate<? super T> predicate)

Constructor that performs no validation. Use predicateTransformer if you want that.

Parameters
predicate:Predicate<? super T>

the predicate to call, not null

Method Detail

getPredicateback to summary
public Predicate<? super T> getPredicate()

Gets the predicate.

Returns:Predicate<? super T>

the predicate

Since
3.1
predicateTransformerback to summary
public static <T> Transformer<T, Boolean> predicateTransformer(final Predicate<? super T> predicate)

Factory method that performs validation.

Parameters
<T>
the input type
predicate:Predicate<? super T>

the predicate to call, not null

Returns:Transformer<T, Boolean>

the predicate transformer

Exceptions
IllegalArgumentException:
if the predicate is null
transformback to summary
public Boolean transform(final T input)

Implements org.apache.commons.collections4.Transformer.transform.

Transforms the input to result by calling a predicate.

Parameters
input:T

the input object to transform

Returns:Boolean

the transformed result

Annotations
@Override