com.legstar.coxb.transform
Class AbstractTransformer

java.lang.Object
  extended by com.legstar.coxb.transform.AbstractTransformer
All Implemented Interfaces:
IHostTransformer
Direct Known Subclasses:
AbstractHostToJavaTransformer, AbstractJavaToHostTransformer

public abstract class AbstractTransformer
extends Object
implements IHostTransformer

Transformers provide the foundation for host data transformations. Implementing classes typically provide the binding class and inherit the transformation capabilities.


Constructor Summary
AbstractTransformer()
          Create a transformer using default COBOL parameters.
AbstractTransformer(CobolContext cobolContext)
          Create a transformer using a specific COBOL parameters set.
AbstractTransformer(String hostCharset)
          Create a transformer using a specific host character set while other COBOL parameters are set by default.
 
Method Summary
 ICobolComplexBinding getBinding()
          Deprecated. replaced by newBinding
 int getByteLength()
          The COBOL complex element maximum length in bytes.
 ICobolComplexBinding getCachedBinding()
           
 ICobolBindingVisitorsFactory getCobolBindingVisitorsFactory()
           
 CobolContext getCobolContext()
          Returns the current COBOL parameter set.
 ICobolConverters getCobolConverters()
          This method returns the current set of COBOL converters.
 ICobolComplexBinding newBinding()
          For backward compatibility, we invoke the old getBinding.
 void setCobolBindingVisitorsFactory(ICobolBindingVisitorsFactory cobolBindingVisitorsFactory)
           
 void setCobolContext(CobolContext cobolContext)
          Change the COBOL parameter sets of the converters.
 void setCobolConverters(ICobolConverters cobolConverters)
          Caller can pass his own set of converters if he is not satisfied with the default.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTransformer

public AbstractTransformer()
Create a transformer using default COBOL parameters.


AbstractTransformer

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

Parameters:
hostCharset - the host character set

AbstractTransformer

public AbstractTransformer(CobolContext cobolContext)
Create a transformer using a specific COBOL parameters set.

Parameters:
cobolContext - the COBOL parameters set.
Method Detail

getCobolConverters

public ICobolConverters getCobolConverters()
This method returns the current set of COBOL converters.

Specified by:
getCobolConverters in interface IHostTransformer
Returns:
a set of COBOL converters

setCobolConverters

public void setCobolConverters(ICobolConverters cobolConverters)
Caller can pass his own set of converters if he is not satisfied with the default.

Specified by:
setCobolConverters in interface IHostTransformer
Parameters:
cobolConverters - the new set of COBOL converters

getCobolContext

public CobolContext getCobolContext()
Returns the current COBOL parameter set.

Specified by:
getCobolContext in interface IHostTransformer
Returns:
a COBOL parameter set

setCobolContext

public void setCobolContext(CobolContext cobolContext)
Change the COBOL parameter sets of the converters.

Specified by:
setCobolContext in interface IHostTransformer
Parameters:
cobolContext - the new COBOL parameter set

getCobolBindingVisitorsFactory

public ICobolBindingVisitorsFactory getCobolBindingVisitorsFactory()
Specified by:
getCobolBindingVisitorsFactory in interface IHostTransformer
Returns:
the Factory that provides concrete implementations of marshalers/unmarshalers

setCobolBindingVisitorsFactory

public void setCobolBindingVisitorsFactory(ICobolBindingVisitorsFactory cobolBindingVisitorsFactory)
Specified by:
setCobolBindingVisitorsFactory in interface IHostTransformer
Parameters:
cobolBindingVisitorsFactory - the Factory that provides concrete implementations of marshalers/unmarshalers to set

getCachedBinding

public ICobolComplexBinding getCachedBinding()
                                      throws CobolBindingException
Returns:
the cached binding if one is available otherwise will request a new one from a descendant.
Throws:
CobolBindingException - if binding cannot be built

getBinding

public ICobolComplexBinding getBinding()
                                throws CobolBindingException
Deprecated. replaced by newBinding

Sub classes used to implement this deprecated method.

Specified by:
getBinding in interface IHostTransformer
Returns:
the binding corresponding to the host structure type. Such a binding can either be statically produced by com.legstar.coxb.gen.CoxbBindingGenerator, or dynamically built by com.legstar.coxb.impl.reflect.CComplexBinding.
Throws:
CobolBindingException - if binding cannot be returned

newBinding

public ICobolComplexBinding newBinding()
                                throws CobolBindingException
For backward compatibility, we invoke the old getBinding. All new sub classes override this method.

Specified by:
newBinding in interface IHostTransformer
Returns:
a new binding corresponding to the host structure type. Such a binding can either be statically produced by com.legstar.coxb.gen.CoxbBindingGenerator, or dynamically built by com.legstar.coxb.impl.reflect.CComplexBinding.
Throws:
CobolBindingException - if binding cannot be returned

getByteLength

public int getByteLength()
                  throws CobolBindingException
The COBOL complex element maximum length in bytes.

Specified by:
getByteLength in interface IHostTransformer
Returns:
COBOL complex element maximum length in bytes
Throws:
CobolBindingException - if maximum byte length cannot be computed


Copyright © 2015 LegSem. All Rights Reserved.