public abstract class FromCobolVisitor extends Object implements CobolVisitor
Mainframe data is expected as a byte array.
| Modifier and Type | Class and Description |
|---|---|
static interface |
FromCobolVisitor.ArrayTypeItemHandler
Notifies specialized implementations when an array's item has been
visited.
|
static interface |
FromCobolVisitor.ChoiceTypeAlternativeHandler
Notifies specialized implementations when an alternative has been
selected and visited
|
static interface |
FromCobolVisitor.ComplexTypeChildHandler
Notifies specialized implementations when a complex type child has been
visited.
|
static interface |
FromCobolVisitor.PrimitiveTypeHandler
Notifies specialized implementations when a primitive type has been
visited (and hence its value is known).
|
| Constructor and Description |
|---|
FromCobolVisitor(CobolContext cobolContext,
byte[] hostData,
int start,
int length) |
FromCobolVisitor(CobolContext cobolContext,
byte[] hostData,
int start,
int length,
FromCobolChoiceStrategy customChoiceStrategy) |
FromCobolVisitor(CobolContext cobolContext,
byte[] hostData,
int start,
int length,
FromCobolChoiceStrategy customChoiceStrategy,
Set<String> customVariables) |
| Modifier and Type | Method and Description |
|---|---|
CobolContext |
getCobolContext() |
String |
getCurFieldFullCobolName() |
String |
getCurFieldName()
Field being visited.
|
byte[] |
getHostData()
Incoming mainframe data.
|
int |
getLastPos()
After the visitor is done visiting, this will contain the last position
in the incoming mainframe data buffer that was processed.
|
int |
getLength()
How many bytes of hostData contains actual data to process.
|
int |
getStart()
Where to start processing in the incoming mainframe data buffer.
|
Map<String,Object> |
getVariables()
The set of custom variables and ODOObjects collected while visiting.
|
boolean |
isCustomVariable(CobolPrimitiveType<?> type,
String name)
A primitive type is a custom variable if it has been marked as so via one
of the available mechanisms or is needed to make choice decisions.
|
void |
putVariable(String name,
Object value)
Keep track of a variable's value
|
void |
setLastPos(int lastPos)
Specialized implementations might need to advance the last position.
|
void |
visitCobolArrayType(CobolArrayType type,
FromCobolVisitor.ArrayTypeItemHandler callback)
Visit an array type which visits each items in turn.
|
void |
visitCobolChoiceType(CobolChoiceType choiceType,
FromCobolVisitor.ChoiceTypeAlternativeHandler callback)
Visit a choice type (COBOL REDEFINES) which determines which alternative
must be selected.
|
void |
visitCobolPrimitiveType(CobolPrimitiveType<?> type,
FromCobolVisitor.PrimitiveTypeHandler callback)
Visit a primitive type performing the actual conversion to a java object.
|
void |
visitComplexType(CobolComplexType type,
FromCobolVisitor.ComplexTypeChildHandler callback)
Visit a complex type which visits each of its children in turn.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvisit, visit, visit, visitpublic FromCobolVisitor(CobolContext cobolContext, byte[] hostData, int start, int length)
public FromCobolVisitor(CobolContext cobolContext, byte[] hostData, int start, int length, FromCobolChoiceStrategy customChoiceStrategy)
public FromCobolVisitor(CobolContext cobolContext, byte[] hostData, int start, int length, FromCobolChoiceStrategy customChoiceStrategy, Set<String> customVariables)
public void visitComplexType(CobolComplexType type, FromCobolVisitor.ComplexTypeChildHandler callback)
Optional children may be skipped.
type - the complex type to visitcallback - a function that is invoked for each child in turn after
it has been visitedpublic void visitCobolArrayType(CobolArrayType type, FromCobolVisitor.ArrayTypeItemHandler callback)
Size of the array might be inferred from an ODOObject visited before this array.
type - the array's item typecallback - a function that is invoked for each item in turn after it
has been visitedpublic void visitCobolChoiceType(CobolChoiceType choiceType, FromCobolVisitor.ChoiceTypeAlternativeHandler callback)
choiceType - the choice typecallback - a function that is invoked after the selected alternative
has been visitedpublic void visitCobolPrimitiveType(CobolPrimitiveType<?> type, FromCobolVisitor.PrimitiveTypeHandler callback) throws FromCobolException
If there is an extra offset left over by a previous item, adjust the position accordingly.
type - the primitive typecallback - a function that is invoked after the primitive type has
been visitedFromCobolException - conversion failurepublic byte[] getHostData()
public int getStart()
public int getLength()
public int getLastPos()
public void setLastPos(int lastPos)
lastPos - last position in the incoming mainframe byte arraypublic void putVariable(String name, Object value)
name - the variable namevalue - the variable valuepublic Map<String,Object> getVariables()
public boolean isCustomVariable(CobolPrimitiveType<?> type, String name)
type - the primitive typename - the variable namepublic String getCurFieldName()
public String getCurFieldFullCobolName()
public CobolContext getCobolContext()
Copyright © 2021 LegSem. All rights reserved.