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

Class ChainedTransformer

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

All Implemented Interfaces:
Transformer, Serializable


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

Transformer implementation that chains the specified closures together.
Since:
Commons Collections 3.0
Author:
Stephen Colebourne

Constructor Summary

ChainedTransformer(Transformer[] transformers)

Constructor that performs no validation.

Method Summary

static Transformer

getInstance(Transformer[] transformers)

Factory method that performs validation and copies the parameter array.

static Transformer

getInstance(Collection transformers)

Create a new Transformer that calls each transformer in turn, passing the result into the next transformer.

static Transformer

getInstance(Transformer transformer1, Transformer transformer2)

Factory method that performs validation.

Object

transform(Object object)

Execute a list of transformers.

Constructor Details

ChainedTransformer

public ChainedTransformer(Transformer[] transformers)

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

Parameters:
transformers - the transformers to chain, not copied, no nulls

Method Details

getInstance

public static Transformer getInstance(Collection transformers)

Create a new Transformer that calls each transformer in turn, passing the result into the next transformer. The ordering is that of the iterator() method on the collection.

Parameters:
transformers - a collection of transformers to chain
Returns:
the chained transformer
Throws:
- if the transformers collection is null
- if any transformer in the collection is null

getInstance

public static Transformer getInstance(Transformer transformer1, Transformer transformer2)

Factory method that performs validation.

Parameters:
transformer1 - the first transformer, not null
transformer2 - the second transformer, not null
Returns:
the chained transformer
Throws:
- if either transformer is null

getInstance

public static Transformer getInstance(Transformer[] transformers)

Factory method that performs validation and copies the parameter array.

Parameters:
transformers - the transformers to chain, copied, no nulls
Returns:
the chained transformer
Throws:
- if the transformers array is null
- if any transformer in the array is null

transform

public Object transform(Object object)

Execute a list of transformers.

Parameters:
object - the input object passed to each transformer