org.apache.commons.collections.functors
Class TransformerClosure<I,O>

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

public class TransformerClosure<I,O>
extends Object
implements Closure<I>, Serializable

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

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

Constructor Summary
TransformerClosure(Transformer<? super I,O> transformer)
          Constructor that performs no validation.
 
Method Summary
 void execute(I input)
          Executes the closure by calling the decorated transformer.
static
<I,O> Closure<I>
getInstance(Transformer<? super I,O> transformer)
          Factory method that performs validation.
 Transformer<? super I,O> getTransformer()
          Gets the transformer.
 
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 I,O> transformer)
Constructor that performs no validation. Use getInstance if you want that.

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

getInstance

public static <I,O> Closure<I> getInstance(Transformer<? super I,O> transformer)
Factory method that performs validation.

A null transformer will return the NOPClosure.

Parameters:
transformer - the transformer to call, null means nop
Returns:
the transformer closure

execute

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

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

getTransformer

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

Returns:
the transformer
Since:
Commons Collections 3.1


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