public class Cob2ObjectValidator extends FromCobolVisitor
Validation can be stopped early by specifying a stop field name. All fields up to this one (inclusive) are validated. The rest of the data is ignored.
Data corresponding to individual fields is validated without necessarily performing the conversion. However, if the field is defined with a range (minInclusive, maxInclusive) then data is converted to check that it fits in the required range.
Upon completion, the lastPos property indicates the last position in the incoming buffer that was validated.
FromCobolVisitor.ArrayTypeItemHandler, FromCobolVisitor.ChoiceTypeAlternativeHandler, FromCobolVisitor.ComplexTypeChildHandler, FromCobolVisitor.PrimitiveTypeHandler| Constructor and Description |
|---|
Cob2ObjectValidator(CobolContext cobolContext,
byte[] hostData) |
Cob2ObjectValidator(CobolContext cobolContext,
byte[] hostData,
int start,
int length) |
Cob2ObjectValidator(CobolContext cobolContext,
byte[] hostData,
int start,
int length,
String stopFieldInclusive) |
Cob2ObjectValidator(CobolContext cobolContext,
byte[] hostData,
int start,
int length,
String stopFieldInclusive,
FromCobolChoiceStrategy customChoiceStrategy) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isValid() |
void |
visit(CobolArrayType type) |
void |
visit(CobolChoiceType type) |
void |
visit(CobolComplexType type) |
void |
visit(CobolPrimitiveType<?> type)
The logic is similar to
FromCobolVisitor.visitCobolPrimitiveType(CobolPrimitiveType, PrimitiveTypeHandler)
but we try to avoid converting data unless this is needed for range
comparison or because the field is a custom variable or an ODOObject. |
getCobolContext, getCurFieldFullCobolName, getCurFieldName, getHostData, getLastPos, getLength, getStart, getVariables, isCustomVariable, putVariable, setLastPos, visitCobolArrayType, visitCobolChoiceType, visitCobolPrimitiveType, visitComplexTypepublic Cob2ObjectValidator(CobolContext cobolContext, byte[] hostData)
public Cob2ObjectValidator(CobolContext cobolContext, byte[] hostData, int start, int length)
public Cob2ObjectValidator(CobolContext cobolContext, byte[] hostData, int start, int length, String stopFieldInclusive)
public Cob2ObjectValidator(CobolContext cobolContext, byte[] hostData, int start, int length, String stopFieldInclusive, FromCobolChoiceStrategy customChoiceStrategy)
public void visit(CobolComplexType type)
public void visit(CobolArrayType type)
public void visit(CobolChoiceType type)
public void visit(CobolPrimitiveType<?> type)
FromCobolVisitor.visitCobolPrimitiveType(CobolPrimitiveType, PrimitiveTypeHandler)
but we try to avoid converting data unless this is needed for range
comparison or because the field is a custom variable or an ODOObject.
public boolean isValid()
Copyright © 2021 LegSem. All rights reserved.