org.apache.tuscany.sca.databinding.json
Class String2JSON

java.lang.Object
  extended by org.apache.tuscany.sca.databinding.impl.BaseTransformer<java.lang.String,java.lang.Object>
      extended by org.apache.tuscany.sca.databinding.json.String2JSON
All Implemented Interfaces:
PullTransformer<java.lang.String,java.lang.Object>, Transformer

public class String2JSON
extends BaseTransformer<java.lang.String,java.lang.Object>
implements PullTransformer<java.lang.String,java.lang.Object>


Constructor Summary
String2JSON()
           
 
Method Summary
protected  java.lang.Class<java.lang.String> getSourceType()
           
 java.lang.String getTargetDataBinding()
          Get the target type that this transformer transforms data into.
protected  java.lang.Class<java.lang.Object> getTargetType()
           
 int getWeight()
          Get the cost of the transformation.
 java.lang.Object transform(java.lang.String source, TransformationContext context)
          Transform source data into the result type.
 
Methods inherited from class org.apache.tuscany.sca.databinding.impl.BaseTransformer
getSourceDataBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.tuscany.sca.databinding.Transformer
getSourceDataBinding
 

Constructor Detail

String2JSON

public String2JSON()
Method Detail

getSourceType

protected java.lang.Class<java.lang.String> getSourceType()
Specified by:
getSourceType in class BaseTransformer<java.lang.String,java.lang.Object>

getTargetType

protected java.lang.Class<java.lang.Object> getTargetType()
Specified by:
getTargetType in class BaseTransformer<java.lang.String,java.lang.Object>

transform

public java.lang.Object transform(java.lang.String source,
                                  TransformationContext context)
Description copied from interface: PullTransformer
Transform source data into the result type.

Specified by:
transform in interface PullTransformer<java.lang.String,java.lang.Object>
Parameters:
source - The source data
context - The context for the transformation
Returns:
The transformed result

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
Overrides:
getWeight in class BaseTransformer<java.lang.String,java.lang.Object>
Returns:
An integer representing the cost of the transformation

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
Overrides:
getTargetDataBinding in class BaseTransformer<java.lang.String,java.lang.Object>
Returns:
A key identifying the target type