org.apache.tuscany.sca.databinding.impl
Class PipedTransformer<S,I,R>

java.lang.Object
  extended by org.apache.tuscany.sca.databinding.impl.PipedTransformer<S,I,R>
Type Parameters:
S - Source type
I - Intermediate type
R - Result type
All Implemented Interfaces:
PullTransformer<S,R>, Transformer

public class PipedTransformer<S,I,R>
extends java.lang.Object
implements PullTransformer<S,R>

A utility class to connect PushTransformer and DataPipe to create a PullTransformer


Constructor Summary
PipedTransformer(PushTransformer<S,I> pumper, DataPipeTransformer<I,R> pipe)
           
 
Method Summary
 java.lang.String getSourceDataBinding()
          Get the source type that this transformer transforms data from.
 java.lang.String getTargetDataBinding()
          Get the target type that this transformer transforms data into.
 int getWeight()
          Get the cost of the transformation.
 R transform(S source, TransformationContext context)
          Transform source data into the result type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PipedTransformer

public PipedTransformer(PushTransformer<S,I> pumper,
                        DataPipeTransformer<I,R> pipe)
Parameters:
pumper -
pipe -
Method Detail

transform

public R transform(S source,
                   TransformationContext context)
Description copied from interface: PullTransformer
Transform source data into the result type.

Specified by:
transform in interface PullTransformer<S,R>
Parameters:
source - The source data
context - The context for the transformation
Returns:
The transformed result

getSourceDataBinding

public java.lang.String getSourceDataBinding()
Description copied from interface: Transformer
Get the source type that this transformer transforms data from. The type is used as the key when the transformer is registered with TransformerRegistry.

Specified by:
getSourceDataBinding in interface Transformer
Returns:
A key identifying the source type

getTargetDataBinding

public java.lang.String getTargetDataBinding()
Description copied from interface: Transformer
Get the target type that this transformer transforms data into. The type is used as the key when the transformer is registered with TransformerRegistry.

Specified by:
getTargetDataBinding in interface Transformer
Returns:
A key identifying the target type

getWeight

public int getWeight()
Description copied from interface: Transformer
Get the cost of the transformation. The weight can be used to choose the most efficient path if there are more than one available from the source to the target.

Specified by:
getWeight in interface Transformer
Returns:
An integer representing the cost of the transformation