org.apache.commons.collections4.functors
Class TransformerClosure<E>

java.lang.Object
  extended by org.apache.commons.collections4.functors.TransformerClosure<E>
All Implemented Interfaces:
Serializable, Closure<E>

public class TransformerClosure<E>
extends Object
implements Closure<E>, Serializable

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

Since:
3.0
Version:
$Id: TransformerClosure.java 1477798 2013-04-30 19:49:02Z tn $
See Also:
Serialized Form

Constructor Summary
TransformerClosure(Transformer<? super E,?> transformer)
          Constructor that performs no validation.
 
Method Summary
 void execute(E input)
          Executes the closure by calling the decorated transformer.
 Transformer<? super E,?> getTransformer()
          Gets the transformer.
static
<E> Closure<E>
transformerClosure(Transformer<? super E,?> transformer)
          Factory method that performs validation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformerClosure

public TransformerClosure(Transformer<? super E,?> transformer)
Constructor that performs no validation. Use transformerClosure if you want that.

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

transformerClosure

public static <E> Closure<E> transformerClosure(Transformer<? super E,?> transformer)
Factory method that performs validation.

A null transformer will return the NOPClosure.

Type Parameters:
E - the type that the closure acts on
Parameters:
transformer - the transformer to call, null means nop
Returns:
the transformer closure

execute

public void execute(E input)
Executes the closure by calling the decorated transformer.

Specified by:
execute in interface Closure<E>
Parameters:
input - the input object

getTransformer

public Transformer<? super E,?> getTransformer()
Gets the transformer.

Returns:
the transformer
Since:
3.1


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