com.legstar.coxb.transform
Class AbstractHostToJavaTransformer

java.lang.Object
  extended by com.legstar.coxb.transform.AbstractTransformer
      extended by com.legstar.coxb.transform.AbstractHostToJavaTransformer
All Implemented Interfaces:
IHostToJavaTransformer, IHostTransformer

public abstract class AbstractHostToJavaTransformer
extends AbstractTransformer
implements IHostToJavaTransformer

Generic methods to transform host data to java.

Implementing classes should inherit from AbstractHostToJavaTransformer and implement the getBinding method.

This is sample code with dynamic binding:

 public class HostToJavaLsfileaeTransformer extends
         AbstractHostToJavaTransformer {
     public ICobolComplexBinding getBinding() throws BindingException {
         try {
             CComplexReflectBinding binding = new CComplexReflectBinding(
                     new com.legstar.test.coxb.lsfileae.ObjectFactory(),
                     com.legstar.test.coxb.lsfileae.Dfhcommarea.class);
             return binding;
         } catch (ReflectBindingException e) {
             throw new BindingException(e);
         }
     }
 }
 

This is sample code with static binding:

 public class HostToJavaLsfileaeTransformer extends
         AbstractHostToJavaTransformer {
     public ICobolComplexBinding getBinding() throws BindingException {
         return new com.legstar.test.coxb.lsfileae.DfhcommareaBinding();
     }
 }
 


Constructor Summary
AbstractHostToJavaTransformer()
          Create a Host to Java transformer using default COBOL parameters.
AbstractHostToJavaTransformer(CobolContext cobolContext)
          Create a Host to Java transformer using a specific COBOL parameters set.
AbstractHostToJavaTransformer(String hostCharset)
          Create a Host to Java transformer using a specific host character set while other COBOL parameters are set by default.
 
Method Summary
<T> T
transform(byte[] hostData)
          Transforms host data to java data object.
<T> T
transform(byte[] hostData, HostTransformStatus status)
          Transforms host data to java data object.
<T> T
transform(byte[] hostData, int offset)
          Transforms host data to java data object.
<T> T
transform(byte[] hostData, int offset, HostTransformStatus status)
          Transforms host data to java data object.
<T> T
transform(byte[] hostData, int offset, String hostCharset)
          Transforms host data to java data object with a specific host character set.
<T> T
transform(byte[] hostData, int offset, String hostCharset, HostTransformStatus status)
          Transforms host data to java data object with a specific host character set.
<T> T
transform(byte[] hostData, String hostCharset)
          Transforms host data to java data object with a specific host character set.
<T> T
transform(byte[] hostData, String hostCharset, HostTransformStatus status)
          Transforms host data to java data object with a specific host character set.
 
Methods inherited from class com.legstar.coxb.transform.AbstractTransformer
getBinding, getByteLength, getCachedBinding, getCobolBindingVisitorsFactory, getCobolContext, getCobolConverters, newBinding, setCobolBindingVisitorsFactory, setCobolContext, setCobolConverters
 
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.IHostTransformer
getBinding, getByteLength, getCobolBindingVisitorsFactory, getCobolContext, getCobolConverters, newBinding, setCobolBindingVisitorsFactory, setCobolContext, setCobolConverters
 

Constructor Detail

AbstractHostToJavaTransformer

public AbstractHostToJavaTransformer()
Create a Host to Java transformer using default COBOL parameters.


AbstractHostToJavaTransformer

public AbstractHostToJavaTransformer(String hostCharset)
Create a Host to Java transformer using a specific host character set while other COBOL parameters are set by default.

Parameters:
hostCharset - the host character set

AbstractHostToJavaTransformer

public AbstractHostToJavaTransformer(CobolContext cobolContext)
Create a Host to Java transformer using a specific COBOL parameters set.

Parameters:
cobolContext - the COBOL parameters set.
Method Detail

transform

public <T> T transform(byte[] hostData)
            throws HostTransformException
Transforms host data to java data object.

Specified by:
transform in interface IHostToJavaTransformer
Type Parameters:
T - the bound object type
Parameters:
hostData - a byte array containing host data
Returns:
a Java value object
Throws:
HostTransformException - if transformation fails

transform

public <T> T transform(byte[] hostData,
                       int offset)
            throws HostTransformException
Transforms host data to java data object.

Specified by:
transform in interface IHostToJavaTransformer
Type Parameters:
T - the bound object type
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

transform

public <T> T transform(byte[] hostData,
                       String hostCharset)
            throws HostTransformException
Transforms host data to java data object with a specific host character set.

Specified by:
transform in interface IHostToJavaTransformer
Type Parameters:
T - the bound object type
Parameters:
hostData - a byte array containing host data
hostCharset - the host character set
Returns:
a Java value object
Throws:
HostTransformException - if transformation fails

transform

public <T> T transform(byte[] hostData,
                       int offset,
                       String hostCharset)
            throws HostTransformException
Transforms host data to java data object with a specific host character set.

Specified by:
transform in interface IHostToJavaTransformer
Type Parameters:
T - the bound object type
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

transform

public <T> T transform(byte[] hostData,
                       String hostCharset,
                       HostTransformStatus status)
            throws HostTransformException
Transforms host data to java data object with a specific host character set.

Specified by:
transform in interface IHostToJavaTransformer
Type Parameters:
T - the bound object type
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

transform

public <T> T transform(byte[] hostData,
                       int offset,
                       String hostCharset,
                       HostTransformStatus status)
            throws HostTransformException
Transforms host data to java data object with a specific host character set.

Specified by:
transform in interface IHostToJavaTransformer
Type Parameters:
T - the bound object type
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

transform

public <T> T transform(byte[] hostData,
                       HostTransformStatus status)
            throws HostTransformException
Transforms host data to java data object.

Specified by:
transform in interface IHostToJavaTransformer
Type Parameters:
T - the bound object type
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

transform

public <T> T transform(byte[] hostData,
                       int offset,
                       HostTransformStatus status)
            throws HostTransformException
Transforms host data to java data object.

Specified by:
transform in interface IHostToJavaTransformer
Type Parameters:
T - the bound object type
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.