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

public Class TransformerClosure<E>

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

Closure implementation that calls a Transformer using the input object and ignore the result.
Since
3.0

Field Summary

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

The transformer to wrap

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
public
TransformerClosure(final Transformer<? super E, ?>
the transformer to call, not null
transformer
)

Constructor that performs no validation.

Method Summary

Modifier and TypeMethod and Description
public void
execute(final E
the input object
input
)

Implements org.apache.commons.collections4.Closure.execute.

Executes the closure by calling the decorated transformer.
public Transformer<? super E, ?>

Returns:

the transformer
getTransformer
()

Gets the transformer.

public static <
the type that the closure acts on
E
>
Closure<E>

Returns:

the transformer closure
transformerClosure
(final Transformer<? super E, ?>
the transformer to call, null means nop
transformer
)

Factory method that performs validation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

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

The transformer to wrap

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

TransformerClosureback to summary
public TransformerClosure(final Transformer<? super E, ?> transformer)

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

Parameters
transformer:Transformer<? super E, ?>

the transformer to call, not null

Method Detail

executeback to summary
public void execute(final E input)

Implements org.apache.commons.collections4.Closure.execute.

Executes the closure by calling the decorated transformer.

Parameters
input:E

the input object

Annotations
@Override
getTransformerback to summary
public Transformer<? super E, ?> getTransformer()

Gets the transformer.

Returns:Transformer<? super E, ?>

the transformer

Since
3.1
transformerClosureback to summary
public static <E> Closure<E> transformerClosure(final Transformer<? super E, ?> transformer)

Factory method that performs validation.

A null transformer will return the NOPClosure.

Parameters
<E>
the type that the closure acts on
transformer:Transformer<? super E, ?>

the transformer to call, null means nop

Returns:Closure<E>

the transformer closure