Top Description Fields Constructors Methods
org.apache.commons.collections4.functors

public Class ChainedTransformer<T>

extends Object
implements Transformer<T, T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.apache.commons.collections4.Transformer
Imports
java.io.Serializable, java.util.Collection, org.apache.commons.collections4.Transformer

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.

Since
3.0

Field Summary

Modifier and TypeField and Description
private final Transformer<? super T, ? extends T>[]
iTransformers

The transformers to call in turn

private static final long
serialVersionUID

Serial version UID

Constructor Summary

AccessConstructor and Description
private
ChainedTransformer(final boolean
if true the input argument will be cloned
clone
,
final Transformer<? super T, ? extends T>[]
the transformers to chain, no nulls
transformers
)

Hidden constructor for the use by the static factory methods.

public
ChainedTransformer(final Transformer<? super T, ? extends T>...
the transformers to chain, copied, no nulls
transformers
)

Constructor that performs no validation.

Method Summary

Modifier and TypeMethod and Description
public static <
the object type
T
>
Transformer<T, T>

Returns:

the chained transformer
chainedTransformer
(final Transformer<? super T, ? extends T>...
the transformers to chain, copied, no nulls
transformers
)

Factory method that performs validation and copies the parameter array.

public static <
the object type
T
>
Transformer<T, T>

Returns:

the chained transformer
chainedTransformer
(final Collection<? extends Transformer<? super T, ? extends T>>
a collection of transformers to chain
transformers
)

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

public Transformer<? super T, ? extends T>[]

Returns:

a copy of the transformers
getTransformers
()

Gets the transformers.

public T

Returns:

the transformed result
transform
(T
the input object passed to the first transformer
object
)

Implements org.apache.commons.collections4.Transformer.transform.

Transforms the input to result via each decorated transformer
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

iTransformersback to summary
private final Transformer<? super T, ? extends T>[] iTransformers

The transformers to call in turn

serialVersionUIDback to summary
private static final long serialVersionUID

Serial version UID

Constructor Detail

ChainedTransformerback to summary
private ChainedTransformer(final boolean clone, final Transformer<? super T, ? extends T>[] transformers)

Hidden constructor for the use by the static factory methods.

Parameters
clone:boolean

if true the input argument will be cloned

transformers:Transformer<? super T, ? extends T>[]

the transformers to chain, no nulls

ChainedTransformerback to summary
public ChainedTransformer(final Transformer<? super T, ? extends T>... transformers)

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

Parameters
transformers:Transformer<? super T, ? extends T>[]

the transformers to chain, copied, no nulls

Method Detail

chainedTransformerback to summary
public static <T> Transformer<T, T> chainedTransformer(final Transformer<? super T, ? extends T>... transformers)

Factory method that performs validation and copies the parameter array.

Parameters
<T>
the object type
transformers:Transformer<? super T, ? extends T>[]

the transformers to chain, copied, no nulls

Returns:Transformer<T, T>

the chained transformer

Exceptions
NullPointerException:
  • if the transformers array is null
  • if any transformer in the array is null
chainedTransformerback to summary
public static <T> Transformer<T, T> chainedTransformer(final Collection<? extends Transformer<? super T, ? extends T>> 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
<T>
the object type
transformers:Collection<? extends Transformer<? super T, ? extends T>>

a collection of transformers to chain

Returns:Transformer<T, T>

the chained transformer

Exceptions
NullPointerException:
  • if the transformers collection is null
  • if any transformer in the collection is null
getTransformersback to summary
public Transformer<? super T, ? extends T>[] getTransformers()

Gets the transformers.

Returns:Transformer<? super T, ? extends T>[]

a copy of the transformers

Since
3.1
transformback to summary
public T transform(T object)

Implements org.apache.commons.collections4.Transformer.transform.

Transforms the input to result via each decorated transformer

Parameters
object:T

the input object passed to the first transformer

Returns:T

the transformed result

Annotations
@Override