com.legstar.coxb.transform
Class AbstractJsonToHostTransformer

java.lang.Object
  extended by com.legstar.coxb.transform.AbstractJsonToHostTransformer
All Implemented Interfaces:
IJsonToHostTransformer

public abstract class AbstractJsonToHostTransformer
extends Object
implements IJsonToHostTransformer

Generic methods to transform JSON to host data.


Constructor Summary
AbstractJsonToHostTransformer(IJavaToHostTransformer javaToHostTransformer)
          Create an JSON to Host transformer using a Java to Host transformer.
 
Method Summary
 IJavaToHostTransformer getJavaToHostTransformer()
           
 Object getObjectFromJson(Reader reader)
          Unmarshal an JSON to get the JAXB value object.
 byte[] transform(Reader reader)
          Transforms JSON to host data.
 byte[] transform(Reader reader, HostTransformStatus status)
          Transforms JSON to host data with a specific host character set.
 byte[] transform(Reader reader, String hostCharset)
          Transforms JSON to host data with a specific host character set.
 byte[] transform(Reader reader, String hostCharset, HostTransformStatus status)
          Transforms JSON to host data with a specific host character set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractJsonToHostTransformer

public AbstractJsonToHostTransformer(IJavaToHostTransformer javaToHostTransformer)
                              throws HostTransformException
Create an JSON to Host transformer using a Java to Host transformer.

Parameters:
javaToHostTransformer - the java to host transformer
Throws:
HostTransformException - if transformer cannot be created
Method Detail

transform

public byte[] transform(Reader reader,
                        String hostCharset,
                        HostTransformStatus status)
                 throws HostTransformException
Transforms JSON to host data with a specific host character set.

Specified by:
transform in interface IJsonToHostTransformer
Parameters:
reader - the JSON Reader to unmarshal JSON data from
hostCharset - the host character set
status - will contain information on the transformation after it is executed
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

transform

public byte[] transform(Reader reader,
                        HostTransformStatus status)
                 throws HostTransformException
Transforms JSON to host data with a specific host character set.

Specified by:
transform in interface IJsonToHostTransformer
Parameters:
reader - the JSON Reader to unmarshal JSON data from
status - will contain information on the transformation after it is executed
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

transform

public byte[] transform(Reader reader,
                        String hostCharset)
                 throws HostTransformException
Transforms JSON to host data with a specific host character set.

Specified by:
transform in interface IJsonToHostTransformer
Parameters:
reader - the JSON Reader to unmarshal JSON data from
hostCharset - the host character set
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

transform

public byte[] transform(Reader reader)
                 throws HostTransformException
Transforms JSON to host data.

Specified by:
transform in interface IJsonToHostTransformer
Parameters:
reader - the JSON Reader to unmarshal JSON data from
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

getObjectFromJson

public Object getObjectFromJson(Reader reader)
                         throws HostTransformException
Unmarshal an JSON to get the JAXB value object.

Parameters:
reader - the JSON Reader to unmarshal JSON data from (such as SAXSource, DOMSource, and StreamSource)
Returns:
a JAXB value object
Throws:
HostTransformException - if transformation fails

getJavaToHostTransformer

public IJavaToHostTransformer getJavaToHostTransformer()
Returns:
the Java to Host transformer


Copyright © 2015 LegSem. All Rights Reserved.