org.decisiondeck.jmcda.xws.transformer
Class OutputTransformer

java.lang.Object
  extended by org.decisiondeck.jmcda.xws.transformer.OutputTransformer

public class OutputTransformer
extends Object


Constructor Summary
OutputTransformer()
           
 
Method Summary
<B> Object
autoTransform(B objectFrom)
          Transforms the given object using a transformer in this object, if one exists.
<T> T
getAs(Object object, Class<T> targetType)
          Retrieves the given object, transformed to the given target type, if possible.
 XMCDADoc getAsDoc(Object source)
          Writes the given object in an XMCDA Document, if a transform is known for that object type.
 void setValidate(boolean validate)
           
 boolean validates()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputTransformer

public OutputTransformer()
Method Detail

getAs

public <T> T getAs(Object object,
                   Class<T> targetType)
Retrieves the given object, transformed to the given target type, if possible. Otherwise, an exception is thrown.

Type Parameters:
T - the target type.
Parameters:
object - not null.
targetType - not null.
Returns:
not null.

getAsDoc

public XMCDADoc getAsDoc(Object source)
Writes the given object in an XMCDA Document, if a transform is known for that object type. The given object is returned if it is a document, or transformed automatically to a document if a transform is known for this object.

Parameters:
source - not null.
Returns:
not null.

autoTransform

public <B> Object autoTransform(B objectFrom)
Transforms the given object using a transformer in this object, if one exists. Otherwise, returns the object itself.

Type Parameters:
B - the type of the object to transform.
Parameters:
objectFrom - not null.
Returns:
not null, because transform functions are supposed not to return null values.

validates

public boolean validates()

setValidate

public void setValidate(boolean validate)
Parameters:
validate - if true, this object will assert that the XMCDA documents it returns are valid. This is the default, and this is recommanded.


Copyright © 2011. All Rights Reserved.