⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections.functors

Class ClosureTransformer

java.lang.Object
|
+--org.apache.commons.collections.functors.ClosureTransformer

All Implemented Interfaces:
Transformer, Serializable


public class ClosureTransformer
extends java.lang.Object
implements Transformer, Serializable

Transformer implementation that calls a Closure using the input object and then returns the input.
Since:
Commons Collections 3.0
Author:
Stephen Colebourne

Constructor Summary

ClosureTransformer(Closure closure)

Constructor that performs no validation.

Method Summary

static Transformer

getInstance(Closure closure)

Factory method that performs validation.

Object

transform(Object input)

Call the closure.

Constructor Details

ClosureTransformer

public ClosureTransformer(Closure closure)

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

Parameters:
closure - the closure to call, not null

Method Details

getInstance

public static Transformer getInstance(Closure closure)

Factory method that performs validation.

Parameters:
closure - the closure to call, not null
Returns:
the closure transformer
Throws:
- if the closure is null

transform

public Object transform(Object input)

Call the closure.

Parameters:
input