org.apache.commons.collections.functors
Class ChainedTransformer
java.lang.Object
org.apache.commons.collections.functors.ChainedTransformer
- Serializable, Transformer
public class ChainedTransformer
extends java.lang.Object
Transformer implementation that chains the specified transformers together.
The input object is passed to the first transformer. The transformed result
is passed to the second transformer and so on.
Version:
- Stephen Colebourne
- Commons Collections 3.0
ChainedTransformer
public ChainedTransformer(Transformer[] transformers)
Constructor that performs no validation.
Use getInstance
if you want that.
transformers
- the transformers to chain, not copied, no nulls
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.
transformers
- a collection of transformers to chain
- the
chained
transformer
getInstance
public static Transformer getInstance(Transformer transformer1,
Transformer transformer2)
Factory method that performs validation.
transformer1
- the first transformer, not nulltransformer2
- the second transformer, not null
- the
chained
transformer
getInstance
public static Transformer getInstance(Transformer[] transformers)
Factory method that performs validation and copies the parameter array.
transformers
- the transformers to chain, copied, no nulls
- the
chained
transformer
getTransformers
public Transformer[] getTransformers()
Gets the transformers, do not modify the array.
- the transformers
- Commons Collections 3.1
transform
public Object transform(Object object)
Transforms the input to result via each decorated transformer
- transform in interface Transformer
object
- the input object passed to the first transformer
- the transformed result
Copyright © 2001-2005 Apache Software Foundation. All Rights Reserved.