com.legstar.coxb.transform
Class AbstractTransformers

java.lang.Object
  extended by com.legstar.coxb.transform.AbstractTransformers
All Implemented Interfaces:
IHostTransformers

public abstract class AbstractTransformers
extends Object
implements IHostTransformers

A generic class that provides transformer capabilities for a given structure.

A structure maps to a java class and a COBOL structure. This class does not implement the transformers, it acts as a container.

Classes derived from this one will typically implement a constructor that creates the directional transformers, java to host and host to java.


Constructor Summary
AbstractTransformers()
          No arg constructor.
AbstractTransformers(IJavaToHostTransformer javaToHost, IHostToJavaTransformer hostToJava)
          Creates a provider with its directional transformers.
 
Method Summary
 IHostToJavaTransformer getHostToJava()
          Return the transformer that turns host data into a java data object.
 IJavaToHostTransformer getJavaToHost()
           
 void setHostToJava(IHostToJavaTransformer hostToJava)
          Sets the transformer that turns host data into a java data object.
 void setJavaToHost(IJavaToHostTransformer javaToHost)
          Sets the transformer that turns a java data object into host data.
 byte[] toHost(Object valueObject)
          Transforms java data object to host data.
 byte[] toHost(Object valueObject, HostTransformStatus status)
          Transforms java data object to host data.
 byte[] toHost(Object valueObject, String hostCharset)
          Transforms java data object to host data with a specific host character set.
 byte[] toHost(Object valueObject, String hostCharset, HostTransformStatus status)
          Transforms java data object to host data with a specific host character set.
 Object toJava(byte[] hostData, HostTransformStatus status)
          Transforms host data to java data object.
 Object toJava(byte[] hostData, int offset)
          Transforms host data to java data object.
 Object toJava(byte[] hostData, int offset, HostTransformStatus status)
          Transforms host data to java data object.
 Object toJava(byte[] hostData, int offset, String hostCharset)
          Transforms host data to java data object with a specific host character set.
 Object toJava(byte[] hostData, int offset, String hostCharset, HostTransformStatus status)
          Transforms host data to java data object with a specific host character set.
 Object toJava(byte[] hostData, String hostCharset, HostTransformStatus status)
          Transforms host data to java data object with a specific host character set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.legstar.coxb.transform.IHostTransformers
toJava, toJava
 

Constructor Detail

AbstractTransformers

public AbstractTransformers()
No arg constructor. Caller is responsible for setting the internal transformers.


AbstractTransformers

public AbstractTransformers(IJavaToHostTransformer javaToHost,
                            IHostToJavaTransformer hostToJava)
Creates a provider with its directional transformers.

Parameters:
javaToHost - java to host transformer
hostToJava - host to java transformer
Method Detail

getJavaToHost

public IJavaToHostTransformer getJavaToHost()
Specified by:
getJavaToHost in interface IHostTransformers
Returns:
the transformer that turns a java data object into host data

setJavaToHost

public void setJavaToHost(IJavaToHostTransformer javaToHost)
Description copied from interface: IHostTransformers
Sets the transformer that turns a java data object into host data.

Specified by:
setJavaToHost in interface IHostTransformers
Parameters:
javaToHost - the the transformer that turns a java data object into host data to set

getHostToJava

public IHostToJavaTransformer getHostToJava()
Description copied from interface: IHostTransformers
Return the transformer that turns host data into a java data object.

Specified by:
getHostToJava in interface IHostTransformers
Returns:
the transformer that turns host data into a java data object

setHostToJava

public void setHostToJava(IHostToJavaTransformer hostToJava)
Description copied from interface: IHostTransformers
Sets the transformer that turns host data into a java data object.

Specified by:
setHostToJava in interface IHostTransformers
Parameters:
hostToJava - the transformer that turns host data into a java data object to set

toHost

public byte[] toHost(Object valueObject,
                     String hostCharset)
              throws HostTransformException
Transforms java data object to host data with a specific host character set.

Specified by:
toHost in interface IHostTransformers
Parameters:
valueObject - a java value object
hostCharset - the host character set
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

toHost

public byte[] toHost(Object valueObject)
              throws HostTransformException
Transforms java data object to host data.

Specified by:
toHost in interface IHostTransformers
Parameters:
valueObject - a java value object
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

toHost

public byte[] toHost(Object valueObject,
                     String hostCharset,
                     HostTransformStatus status)
              throws HostTransformException
Transforms java data object to host data with a specific host character set.

Specified by:
toHost in interface IHostTransformers
Parameters:
valueObject - a java value object
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

toHost

public byte[] toHost(Object valueObject,
                     HostTransformStatus status)
              throws HostTransformException
Transforms java data object to host data.

Specified by:
toHost in interface IHostTransformers
Parameters:
valueObject - a java value object
status - will contain information on the transformation after it is executed
Returns:
a byte array with host data
Throws:
HostTransformException - if transformation fails

toJava

public Object toJava(byte[] hostData,
                     String hostCharset,
                     HostTransformStatus status)
              throws HostTransformException
Transforms host data to java data object with a specific host character set. Provide a default implementation for backward compatibility.

Specified by:
toJava in interface IHostTransformers
Parameters:
hostData - a byte array containing host data
hostCharset - the host character set
status - will contain information on the transformation after it is executed
Returns:
a Java value object
Throws:
HostTransformException - if transformation fails

toJava

public Object toJava(byte[] hostData,
                     HostTransformStatus status)
              throws HostTransformException
Transforms host data to java data object. Provide a default implementation for backward compatibility.

Specified by:
toJava in interface IHostTransformers
Parameters:
hostData - a byte array containing host data
status - will contain information on the transformation after it is executed
Returns:
a Java value object
Throws:
HostTransformException - if transformation fails

toJava

public Object toJava(byte[] hostData,
                     int offset,
                     String hostCharset)
              throws HostTransformException
Transforms host data to java data object with a specific host character set. Provide a default implementation for backward compatibility.

Specified by:
toJava in interface IHostTransformers
Parameters:
hostData - a byte array containing host data
offset - index of first byte to process in hostData
hostCharset - the host character set
Returns:
a Java value object
Throws:
HostTransformException - if transformation fails

toJava

public Object toJava(byte[] hostData,
                     int offset)
              throws HostTransformException
Transforms host data to java data object. Provide a default implementation for backward compatibility.

Specified by:
toJava in interface IHostTransformers
Parameters:
hostData - a byte array containing host data
offset - index of first byte to process in hostData
Returns:
a Java value object
Throws:
HostTransformException - if transformation fails

toJava

public Object toJava(byte[] hostData,
                     int offset,
                     String hostCharset,
                     HostTransformStatus status)
              throws HostTransformException
Transforms host data to java data object with a specific host character set. Provide a default implementation for backward compatibility.

Specified by:
toJava in interface IHostTransformers
Parameters:
hostData - a byte array containing host data
offset - index of first byte to process in hostData
hostCharset - the host character set
status - will contain information on the transformation after it is executed
Returns:
a Java value object
Throws:
HostTransformException - if transformation fails

toJava

public Object toJava(byte[] hostData,
                     int offset,
                     HostTransformStatus status)
              throws HostTransformException
Transforms host data to java data object. Provide a default implementation for backward compatibility.

Specified by:
toJava in interface IHostTransformers
Parameters:
hostData - a byte array containing host data
offset - index of first byte to process in hostData
status - will contain information on the transformation after it is executed
Returns:
a Java value object
Throws:
HostTransformException - if transformation fails


Copyright © 2015 LegSem. All Rights Reserved.