com.legstar.coxb.common
Class CArrayBinding

java.lang.Object
  extended by com.legstar.coxb.common.CBinding
      extended by com.legstar.coxb.common.CArrayBinding
All Implemented Interfaces:
ICobolArrayBinding, ICobolBinding, ICobolElement
Direct Known Subclasses:
CArrayComplexBinding

public abstract class CArrayBinding
extends CBinding
implements ICobolArrayBinding

This generic class implements behavior common to all array bindings.


Constructor Summary
CArrayBinding(String bindingName, String jaxbName, Class<?> jaxbType, CobolElement cobolAnnotations, ICobolComplexBinding parentBinding)
          Constructor for a cobol element to java binding.
 
Method Summary
 int calcByteLength()
          The method calculates the exact host byte length for this Cobol binding.
 int getByteLength()
          Pre version 1.2.4 generated simple arrays did not support the ItemByteLength attribute.
 int getCurrentOccurs()
          Fixed size arrays return the maximum number of occurrences while variable size arrays dynamically compute their dimension.
 int getItemByteLength()
          In COBOL, arrays are collections of items with a fixed size.
 boolean isVariableSize()
          This test cannot be done at construction time because the depending on property can be added later.
 void setItemByteLength(int itemByteLength)
          Set the individual item host byte size.
 
Methods inherited from class com.legstar.coxb.common.CBinding
cast, getBindingName, getCobolName, getCobolType, getDefaultValue, getDependingOn, getFractionDigits, getJaxbName, getJaxbType, getLevelNumber, getMarshalChoiceStrategyClassName, getMaxOccurs, getMinOccurs, getParentBinding, getPicture, getRedefines, getSrceLine, getTotalDigits, getUnmarshalChoiceStrategyClassName, getUsage, isBound, isCustomVariable, isGeneratedBinding, isJustifiedRight, isODOObject, isRedefined, isSigned, isSignLeading, isSignSeparate, setBindingName, setByteLength, setCobolName, setCobolType, setDefaultValue, setDependingOn, setFractionDigits, setIsCustomVariable, setIsJustifiedRight, setIsODOObject, setIsRedefined, setIsSigned, setIsSignLeading, setIsSignSeparate, setJaxbName, setJaxbType, setLevelNumber, setMarshalChoiceStrategyClassName, setMaxOccurs, setMinOccurs, setParentBinding, setPicture, setRedefines, setSrceLine, setTotalDigits, setUnmarshalChoiceStrategyClassName, setUsage, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.legstar.coxb.ICobolArrayBinding
calcItemByteLength
 
Methods inherited from interface com.legstar.coxb.ICobolBinding
accept, getBindingName, getJaxbName, getJaxbType, getObjectValue, getParentBinding, isBound, isSet, setObjectValue
 
Methods inherited from interface com.legstar.coxb.ICobolElement
getCobolName, getCobolType, getDefaultValue, getDependingOn, getFractionDigits, getLevelNumber, getMarshalChoiceStrategyClassName, getMaxOccurs, getMinOccurs, getPicture, getRedefines, getSrceLine, getTotalDigits, getUnmarshalChoiceStrategyClassName, getUsage, isCustomVariable, isJustifiedRight, isODOObject, isRedefined, isSigned, isSignLeading, isSignSeparate, setByteLength, setCobolName, setCobolType, setDefaultValue, setDependingOn, setFractionDigits, setIsCustomVariable, setIsJustifiedRight, setIsODOObject, setIsRedefined, setIsSigned, setIsSignLeading, setIsSignSeparate, setLevelNumber, setMarshalChoiceStrategyClassName, setMaxOccurs, setMinOccurs, setPicture, setRedefines, setSrceLine, setTotalDigits, setUnmarshalChoiceStrategyClassName, setUsage
 

Constructor Detail

CArrayBinding

public CArrayBinding(String bindingName,
                     String jaxbName,
                     Class<?> jaxbType,
                     CobolElement cobolAnnotations,
                     ICobolComplexBinding parentBinding)
Constructor for a cobol element to java binding.

Parameters:
bindingName - the identifier for this binding
jaxbName - the name of the bound java property
jaxbType - the type of the bound java property
cobolAnnotations - the cobol annotations for this element
parentBinding - a reference to the parent binding if any
Method Detail

getCurrentOccurs

public int getCurrentOccurs()
                     throws HostException
Fixed size arrays return the maximum number of occurrences while variable size arrays dynamically compute their dimension.

Specified by:
getCurrentOccurs in interface ICobolArrayBinding
Returns:
the current number of items
Throws:
HostException - if count cannot be computed

calcByteLength

public int calcByteLength()
The method calculates the exact host byte length for this Cobol binding.

If length exceed Integer.MAX_VALUE, returns Integer.MAX_VALUE.

Specified by:
calcByteLength in interface ICobolBinding
Returns:
the host byte length of this binding

isVariableSize

public boolean isVariableSize()
This test cannot be done at construction time because the depending on property can be added later.

Returns:
true if this is a variable size array

getByteLength

public int getByteLength()
Pre version 1.2.4 generated simple arrays did not support the ItemByteLength attribute. Their ByteLength attribute was actually the ItemByteLength instead of being the size of the entire array. We need to continue supporting this old model. Hence the size adjustment here.

Specified by:
getByteLength in interface ICobolElement
Overrides:
getByteLength in class CBinding
Returns:
the Cobol element length in bytes

getItemByteLength

public int getItemByteLength()
In COBOL, arrays are collections of items with a fixed size. This method returns an individual item host byte size.

Specified by:
getItemByteLength in interface ICobolArrayBinding
Returns:
Cobol array individual item length in bytes.

setItemByteLength

public void setItemByteLength(int itemByteLength)
Set the individual item host byte size.

Specified by:
setItemByteLength in interface ICobolArrayBinding
Parameters:
itemByteLength - Cobol array individual item length in bytes.


Copyright © 2015 LegSem. All Rights Reserved.