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

public final Class TransformerPredicate<T>

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

Predicate implementation that returns the result of a transformer.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final Transformer<? super T, Boolean>
iTransformer

The transformer to call

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
public
TransformerPredicate(final Transformer<? super T, Boolean>
the transformer to decorate
transformer
)

Constructor that performs no validation.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if decorated transformer returns Boolean.TRUE
evaluate
(final T
the input object
object
)

Implements org.apache.commons.collections4.Predicate.evaluate.

Evaluates the predicate returning the result of the decorated transformer.
public Transformer<? super T, Boolean>

Returns:

the transformer
getTransformer
()

Gets the transformer.

public static <
the type that the predicate queries
T
>
Predicate<T>

Returns:

the predicate
transformerPredicate
(final Transformer<? super T, Boolean>
the transformer to decorate
transformer
)

Factory to create the predicate.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iTransformerback to summary
private final Transformer<? super T, Boolean> iTransformer

The transformer to call

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

TransformerPredicateback to summary
public TransformerPredicate(final Transformer<? super T, Boolean> transformer)

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

Parameters
transformer:Transformer<? super T, Boolean>

the transformer to decorate

Method Detail

evaluateback to summary
public boolean evaluate(final T object)

Implements org.apache.commons.collections4.Predicate.evaluate.

Evaluates the predicate returning the result of the decorated transformer.

Parameters
object:T

the input object

Returns:boolean

true if decorated transformer returns Boolean.TRUE

Annotations
@Override
Exceptions
FunctorException:
if the transformer returns an invalid type
getTransformerback to summary
public Transformer<? super T, Boolean> getTransformer()

Gets the transformer.

Returns:Transformer<? super T, Boolean>

the transformer

Since
3.1
transformerPredicateback to summary
public static <T> Predicate<T> transformerPredicate(final Transformer<? super T, Boolean> transformer)

Factory to create the predicate.

Parameters
<T>
the type that the predicate queries
transformer:Transformer<? super T, Boolean>

the transformer to decorate

Returns:Predicate<T>

the predicate

Exceptions
NullPointerException:
if the transformer is null