org.apache.commons.collections4
Interface Transformer<I,O>

Type Parameters:
I - the input type to the transformer
O - the output type from the transformer
All Known Implementing Classes:
ChainedTransformer, CloneTransformer, ClosureTransformer, ConstantTransformer, ExceptionTransformer, FactoryTransformer, InstantiateTransformer, InvokerTransformer, MapTransformer, NOPTransformer, PredicateTransformer, StringValueTransformer, SwitchTransformer

public interface Transformer<I,O>

Defines a functor interface implemented by classes that transform one object into another.

A Transformer converts the input object to the output object. The input object should be left unchanged. Transformers are typically used for type conversions, or extracting data from an object.

Standard implementations of common transformers are provided by TransformerUtils. These include method invocation, returning a constant, cloning and returning the string value.

Since:
1.0
Version:
$Id: Transformer.java 1469004 2013-04-17 17:37:03Z tn $

Method Summary
 O transform(I input)
          Transforms the input object (leaving it unchanged) into some output object.
 

Method Detail

transform

O transform(I input)
Transforms the input object (leaving it unchanged) into some output object.

Parameters:
input - the object to be transformed, should be left unchanged
Returns:
a transformed object
Throws:
ClassCastException - (runtime) if the input is the wrong class
IllegalArgumentException - (runtime) if the input is invalid
FunctorException - (runtime) if the transform cannot be completed


Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.