com.legstar.coxb.common
Class CBinding

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

public abstract class CBinding
extends Object
implements ICobolBinding

This class is a superclass of all other element types implementing binding between a java type and cobol. The Cobol properties are the exact equivalent of the CobolElement annotation.

Author:
Fady Moussallam

Constructor Summary
CBinding(String name, String jaxbName, Class<?> jaxbType, CobolElement cobolAnnotations, ICobolComplexBinding parentBinding)
          Constructor for a cobol element to java binding.
 
Method Summary
<T> T
cast(Object x)
          This utility method is used to suppress the need for @SuppressWarnings when we cast objects to List < ?
 String getBindingName()
          Returns the name of this binding element.
 int getByteLength()
          The host byte length calculation is not performed at construction time.
 String getCobolName()
           
 CobolType getCobolType()
           
 String getDefaultValue()
           
 String getDependingOn()
           
 int getFractionDigits()
           
 String getJaxbName()
          Returns the java name of the property bound to this Cobol element.
 Class<?> getJaxbType()
          Returns the java type of the property bound to this Cobol element.
 int getLevelNumber()
           
 String getMarshalChoiceStrategyClassName()
           
 int getMaxOccurs()
           
 int getMinOccurs()
           
 ICobolComplexBinding getParentBinding()
          A binding element might belong to another complex element .
 String getPicture()
           
 String getRedefines()
           
 int getSrceLine()
           
 int getTotalDigits()
           
 String getUnmarshalChoiceStrategyClassName()
           
 String getUsage()
           
 boolean isBound()
          Determines if this Cobol element is bound to a Jaxb property.
 boolean isCustomVariable()
           
 boolean isGeneratedBinding()
           
 boolean isJustifiedRight()
           
 boolean isODOObject()
           
 boolean isRedefined()
           
 boolean isSigned()
           
 boolean isSignLeading()
           
 boolean isSignSeparate()
           
 void setBindingName(String bindingName)
           
 void setByteLength(int byteLength)
           
 void setCobolName(String cobolName)
           
 void setCobolType(CobolType type)
           
 void setDefaultValue(String defaultValue)
           
 void setDependingOn(String dependingOn)
           
 void setFractionDigits(int fractionDigits)
           
 void setIsCustomVariable(boolean isCustomVariable)
           
 void setIsJustifiedRight(boolean isJustifiedRight)
           
 void setIsODOObject(boolean isODOObject)
           
 void setIsRedefined(boolean isRedefined)
           
 void setIsSigned(boolean isSigned)
           
 void setIsSignLeading(boolean isSignLeading)
           
 void setIsSignSeparate(boolean isSignSeparate)
           
 void setJaxbName(String jaxbName)
           
 void setJaxbType(Class<?> jaxbType)
           
 void setLevelNumber(int levelNumber)
           
 void setMarshalChoiceStrategyClassName(String marshalChoiceStrategyClassName)
           
 void setMaxOccurs(int maxOccurs)
           
 void setMinOccurs(int minOccurs)
           
 void setParentBinding(ICobolComplexBinding parentBinding)
           
 void setPicture(String picture)
           
 void setRedefines(String redefines)
           
 void setSrceLine(int srceLine)
           
 void setTotalDigits(int totalDigits)
           
 void setUnmarshalChoiceStrategyClassName(String unmarshalChoiceStrategyClassName)
           
 void setUsage(String usage)
           
 String 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.ICobolBinding
accept, calcByteLength, getObjectValue, isSet, setObjectValue
 

Constructor Detail

CBinding

public CBinding(String name,
                String jaxbName,
                Class<?> jaxbType,
                CobolElement cobolAnnotations,
                ICobolComplexBinding parentBinding)
Constructor for a cobol element to java binding. Dynamic bindings are built from cobol annotations.

Parameters:
name - 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
Method Detail

getCobolName

public String getCobolName()
Specified by:
getCobolName in interface ICobolElement
Returns:
the Cobol element name

setCobolName

public void setCobolName(String cobolName)
Specified by:
setCobolName in interface ICobolElement
Parameters:
cobolName - the Cobol element name to set

getCobolType

public CobolType getCobolType()
Specified by:
getCobolType in interface ICobolElement
Returns:
the Cobol element type

setCobolType

public void setCobolType(CobolType type)
Specified by:
setCobolType in interface ICobolElement
Parameters:
type - the Cobol element type to set

getByteLength

public int getByteLength()
The host byte length calculation is not performed at construction time. This is because some information such as children of complex elements or dimension of arrays might not be known at construction time.

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

setByteLength

public void setByteLength(int byteLength)
Specified by:
setByteLength in interface ICobolElement
Parameters:
byteLength - the Cobol element length in bytes to set

isJustifiedRight

public boolean isJustifiedRight()
Specified by:
isJustifiedRight in interface ICobolElement
Returns:
true if String is right justified

setIsJustifiedRight

public void setIsJustifiedRight(boolean isJustifiedRight)
Specified by:
setIsJustifiedRight in interface ICobolElement
Parameters:
isJustifiedRight - true if String is right justified

getTotalDigits

public int getTotalDigits()
Specified by:
getTotalDigits in interface ICobolElement
Returns:
the total number of digits

setTotalDigits

public void setTotalDigits(int totalDigits)
Specified by:
setTotalDigits in interface ICobolElement
Parameters:
totalDigits - the total number of digits to set

getFractionDigits

public int getFractionDigits()
Specified by:
getFractionDigits in interface ICobolElement
Returns:
the fractional number of digits

setFractionDigits

public void setFractionDigits(int fractionDigits)
Specified by:
setFractionDigits in interface ICobolElement
Parameters:
fractionDigits - the fractional number of digits to set

isSigned

public boolean isSigned()
Specified by:
isSigned in interface ICobolElement
Returns:
true if signed

setIsSigned

public void setIsSigned(boolean isSigned)
Specified by:
setIsSigned in interface ICobolElement
Parameters:
isSigned - true if signed

isSignLeading

public boolean isSignLeading()
Specified by:
isSignLeading in interface ICobolElement
Returns:
true if sign in leading byte

setIsSignLeading

public void setIsSignLeading(boolean isSignLeading)
Specified by:
setIsSignLeading in interface ICobolElement
Parameters:
isSignLeading - true if sign in leading byte

isSignSeparate

public boolean isSignSeparate()
Specified by:
isSignSeparate in interface ICobolElement
Returns:
true if sign occupies a separate byte

setIsSignSeparate

public void setIsSignSeparate(boolean isSignSeparate)
Specified by:
setIsSignSeparate in interface ICobolElement
Parameters:
isSignSeparate - true if sign occupies a separate byte

getMinOccurs

public int getMinOccurs()
Specified by:
getMinOccurs in interface ICobolElement
Returns:
the minimum number of occurences

setMinOccurs

public void setMinOccurs(int minOccurs)
Specified by:
setMinOccurs in interface ICobolElement
Parameters:
minOccurs - the minimum number of occurences to set

getMaxOccurs

public int getMaxOccurs()
Specified by:
getMaxOccurs in interface ICobolElement
Returns:
the maximum number of occurences

setMaxOccurs

public void setMaxOccurs(int maxOccurs)
Specified by:
setMaxOccurs in interface ICobolElement
Parameters:
maxOccurs - the maximum number of occurences to set

getDependingOn

public String getDependingOn()
Specified by:
getDependingOn in interface ICobolElement
Returns:
the Cobol element giving array actual size

setDependingOn

public void setDependingOn(String dependingOn)
Specified by:
setDependingOn in interface ICobolElement
Parameters:
dependingOn - the Cobol element giving array actual size to set

isODOObject

public boolean isODOObject()
Specified by:
isODOObject in interface ICobolElement
Returns:
true if array is variable size

setIsODOObject

public void setIsODOObject(boolean isODOObject)
Specified by:
setIsODOObject in interface ICobolElement
Parameters:
isODOObject - true if array is variable size

getRedefines

public String getRedefines()
Specified by:
getRedefines in interface ICobolElement
Returns:
the Cobol element sharing same memory location

setRedefines

public void setRedefines(String redefines)
Specified by:
setRedefines in interface ICobolElement
Parameters:
redefines - Cobol element sharing same memory location to set

isRedefined

public boolean isRedefined()
Specified by:
isRedefined in interface ICobolElement
Returns:
true if redefined by at least one other element

setIsRedefined

public void setIsRedefined(boolean isRedefined)
Specified by:
setIsRedefined in interface ICobolElement
Parameters:
isRedefined - true if redefined by at least one other element

isCustomVariable

public boolean isCustomVariable()
Specified by:
isCustomVariable in interface ICobolElement
Returns:
true if element is used in custom code

setIsCustomVariable

public void setIsCustomVariable(boolean isCustomVariable)
Specified by:
setIsCustomVariable in interface ICobolElement
Parameters:
isCustomVariable - true if element is used in custom code

getUnmarshalChoiceStrategyClassName

public String getUnmarshalChoiceStrategyClassName()
Specified by:
getUnmarshalChoiceStrategyClassName in interface ICobolElement
Returns:
the name of a class providing additional logic to select an alternative within a choice element at unmarshaling (Host to Java) time.

setUnmarshalChoiceStrategyClassName

public void setUnmarshalChoiceStrategyClassName(String unmarshalChoiceStrategyClassName)
Specified by:
setUnmarshalChoiceStrategyClassName in interface ICobolElement
Parameters:
unmarshalChoiceStrategyClassName - the the name of a class providing additional logic to select an alternative within a choice element at unmarshaling (Host to Java) time.

getMarshalChoiceStrategyClassName

public String getMarshalChoiceStrategyClassName()
Specified by:
getMarshalChoiceStrategyClassName in interface ICobolElement
Returns:
the name of a class providing additional logic to select an alternative within a choice element at marshaling (Java to Host) time.

setMarshalChoiceStrategyClassName

public void setMarshalChoiceStrategyClassName(String marshalChoiceStrategyClassName)
Specified by:
setMarshalChoiceStrategyClassName in interface ICobolElement
Parameters:
marshalChoiceStrategyClassName - the name of a class providing additional logic to select an alternative within a choice element at marshaling (Java to Host) time.

getJaxbName

public String getJaxbName()
Description copied from interface: ICobolBinding
Returns the java name of the property bound to this Cobol element.

Specified by:
getJaxbName in interface ICobolBinding
Returns:
the Java property name bound to this cobol element

setJaxbName

public void setJaxbName(String jaxbName)
Parameters:
jaxbName - the Java property name bound to this cobol element to set

getJaxbType

public Class<?> getJaxbType()
Description copied from interface: ICobolBinding
Returns the java type of the property bound to this Cobol element.

Specified by:
getJaxbType in interface ICobolBinding
Returns:
the Java property type bound to this cobol element

setJaxbType

public void setJaxbType(Class<?> jaxbType)
Parameters:
jaxbType - the Java property type bound to this cobol element to set

getLevelNumber

public int getLevelNumber()
Specified by:
getLevelNumber in interface ICobolElement
Returns:
the Level in the hierarchy

setLevelNumber

public void setLevelNumber(int levelNumber)
Specified by:
setLevelNumber in interface ICobolElement
Parameters:
levelNumber - the Level in the hierarchy to set

getPicture

public String getPicture()
Specified by:
getPicture in interface ICobolElement
Returns:
the Cobol picture clause

setPicture

public void setPicture(String picture)
Specified by:
setPicture in interface ICobolElement
Parameters:
picture - the Cobol picture clause to set

getDefaultValue

public String getDefaultValue()
Specified by:
getDefaultValue in interface ICobolElement
Returns:
the Cobol default value

getUsage

public String getUsage()
Specified by:
getUsage in interface ICobolElement
Returns:
the Cobol usage

setUsage

public void setUsage(String usage)
Specified by:
setUsage in interface ICobolElement
Parameters:
usage - the Cobol usage to set

setDefaultValue

public void setDefaultValue(String defaultValue)
Specified by:
setDefaultValue in interface ICobolElement
Parameters:
defaultValue - the Cobol default value to set

getSrceLine

public int getSrceLine()
Specified by:
getSrceLine in interface ICobolElement
Returns:
the Line number in the original source file

setSrceLine

public void setSrceLine(int srceLine)
Specified by:
setSrceLine in interface ICobolElement
Parameters:
srceLine - the Line number in the original source file to set

isBound

public boolean isBound()
Determines if this Cobol element is bound to a Jaxb property.

Specified by:
isBound in interface ICobolBinding
Returns:
true if element is bound to a jaxb property which name and type are known

getBindingName

public String getBindingName()
Description copied from interface: ICobolBinding
Returns the name of this binding element.

Specified by:
getBindingName in interface ICobolBinding
Returns:
the name of this binding element

setBindingName

public void setBindingName(String bindingName)
Parameters:
bindingName - the binding element name to set

getParentBinding

public ICobolComplexBinding getParentBinding()
Description copied from interface: ICobolBinding
A binding element might belong to another complex element . This method returns a reference to the complex parent binding if any, null otherwise.

Specified by:
getParentBinding in interface ICobolBinding
Returns:
the parent binding

setParentBinding

public void setParentBinding(ICobolComplexBinding parentBinding)
Parameters:
parentBinding - the parent binding to set

cast

public <T> T cast(Object x)
This utility method is used to suppress the need for @SuppressWarnings when we cast objects to List < ? >.

Type Parameters:
T - the list type
Parameters:
x - the object to cast
Returns:
a list object

isGeneratedBinding

public boolean isGeneratedBinding()
Returns:
true if this is a generated binding

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 LegSem. All Rights Reserved.