org.apache.tuscany.sca.databinding.javabeans
Class JavaBean2XMLTransformer<T>

java.lang.Object
  extended by org.apache.tuscany.sca.databinding.impl.BaseTransformer<java.lang.Object,T>
      extended by org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLTransformer<T>
All Implemented Interfaces:
PullTransformer<java.lang.Object,T>, Transformer
Direct Known Subclasses:
Exception2OMElement, JavaBean2DOMNodeTransformer

public abstract class JavaBean2XMLTransformer<T>
extends BaseTransformer<java.lang.Object,T>
implements PullTransformer<java.lang.Object,T>

Transformer to convert data from a JavaBean object to xml


Field Summary
static java.lang.String FWD_SLASH
           
static java.lang.String GET
           
static java.lang.String HTTP
           
protected  SimpleTypeMapperImpl mapper
           
static java.lang.String PERIOD
           
static java.lang.String PREFIX
           
 
Constructor Summary
JavaBean2XMLTransformer()
           
 
Method Summary
abstract  void appendChild(T parentElement, T childElement)
          Add the child element to the parent
abstract  void appendText(T parentElement, java.lang.String textData)
          Create a text node and add it to the parent
abstract  T createElement(javax.xml.namespace.QName qName)
          Create an element with the given name
 java.lang.String getNexPrefix()
           
 java.lang.String getSourceDataBinding()
          Get the source type that this transformer transforms data from.
 java.lang.Class<java.lang.Object> getSourceType()
           
 int getWeight()
          Get the cost of the transformation.
protected  boolean isMappedGetter(java.lang.String methodName)
           
 T transform(java.lang.Object source, TransformationContext context)
          Transform source data into the result type.
 
Methods inherited from class org.apache.tuscany.sca.databinding.impl.BaseTransformer
getTargetDataBinding, getTargetType
 
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
getTargetDataBinding
 

Field Detail

GET

public static final java.lang.String GET
See Also:
Constant Field Values

PREFIX

public static final java.lang.String PREFIX
See Also:
Constant Field Values

PERIOD

public static final java.lang.String PERIOD
See Also:
Constant Field Values

FWD_SLASH

public static final java.lang.String FWD_SLASH
See Also:
Constant Field Values

HTTP

public static final java.lang.String HTTP
See Also:
Constant Field Values

mapper

protected SimpleTypeMapperImpl mapper
Constructor Detail

JavaBean2XMLTransformer

public JavaBean2XMLTransformer()
Method Detail

transform

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

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

isMappedGetter

protected boolean isMappedGetter(java.lang.String methodName)

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

getSourceType

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

getNexPrefix

public java.lang.String getNexPrefix()

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.Object,T>
Returns:
An integer representing the cost of the transformation

createElement

public abstract T createElement(javax.xml.namespace.QName qName)
                         throws Java2XMLMapperException
Create an element with the given name

Parameters:
qName -
Returns:
Throws:
Java2XMLMapperException

appendText

public abstract void appendText(T parentElement,
                                java.lang.String textData)
                         throws Java2XMLMapperException
Create a text node and add it to the parent

Parameters:
parentElement -
textData -
Throws:
Java2XMLMapperException

appendChild

public abstract void appendChild(T parentElement,
                                 T childElement)
                          throws Java2XMLMapperException
Add the child element to the parent

Parameters:
parentElement -
childElement -
Throws:
Java2XMLMapperException