org.apache.commons.collections.functors
Class FactoryTransformer<T>

java.lang.Object
  extended by org.apache.commons.collections.functors.FactoryTransformer<T>
All Implemented Interfaces:
Serializable, Transformer<Object,T>

public class FactoryTransformer<T>
extends Object
implements Transformer<Object,T>, Serializable

Transformer implementation that calls a Factory and returns the result.

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

Constructor Summary
FactoryTransformer(Factory<T> factory)
          Constructor that performs no validation.
 
Method Summary
 Factory<T> getFactory()
          Gets the factory.
static
<T> Transformer<Object,T>
getInstance(Factory<T> factory)
          Factory method that performs validation.
 T transform(Object input)
          Transforms the input by ignoring the input and returning the result of calling the decorated factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FactoryTransformer

public FactoryTransformer(Factory<T> factory)
Constructor that performs no validation. Use getInstance if you want that.

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

getInstance

public static <T> Transformer<Object,T> getInstance(Factory<T> factory)
Factory method that performs validation.

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

transform

public T transform(Object input)
Transforms the input by ignoring the input and returning the result of calling the decorated factory.

Specified by:
transform in interface Transformer<Object,T>
Parameters:
input - the input object to transform
Returns:
the transformed result

getFactory

public Factory<T> getFactory()
Gets the factory.

Returns:
the factory
Since:
Commons Collections 3.1


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