public B customChoiceStrategy( FromCobolChoiceStrategy customChoiceStrategy) { this.customChoiceStrategy = customChoiceStrategy; return self(); }
public Cob2HashMapConverter build() { return new Cob2HashMapConverter(this); }
public FromHostResult < T > convert(byte[] hostData) { return convert(hostData, 0, hostData.length); }
@SuppressWarnings("unchecked") public FromHostResult < Map < String, Object > > convert(byte[] hostData, int start, int length) { Cob2ObjectVisitor visitor = new Cob2ObjectVisitor(getCobolContext(), hostData, start, length, getCustomChoiceStrategy(), getCustomVariables()); visitor.visit(getCobolComplexType()); return new FromHostResult < Map < String, Object > >( visitor.getLastPos(), (Map < String, Object >) visitor.getResultObject()); }
public FromHostResult < SpecificRecord > convert(byte[] hostData, int start, int length) { FromHostResult < GenericRecord > result = converter.convert(hostData, start, length); if (result.getValue() == null) { return null; } this.specificRecord = (SpecificRecord) SpecificData.get().deepCopy( result.getValue().getSchema(), result.getValue()); return new FromHostResult < SpecificRecord >( result.getBytesProcessed(), specificRecord); }
public FromHostResult < GenericRecord > convert(byte[] hostData, int start, int length) { Cob2AvroVisitor visitor = new Cob2AvroVisitor(getCobolContext(), hostData, start, length, getCustomChoiceStrategy(), getCustomVariables(), schema); visitor.visit(getCobolComplexType()); return new FromHostResult < GenericRecord >(visitor.getLastPos(), (GenericRecord) visitor.getResultObject()); }
@SuppressWarnings("unchecked") public D next() { try { ReadRecordStatus status = readRecord(hostBytes, lastProcessed); bytesRead += status.getBytesRead(); int prefixLen = hostBytesPrefixLen(); FromHostResult < GenericRecord > result = converter.convert( hostBytes, prefixLen, status.getRecordLen() == -1 ? hostBytes.length : status .getRecordLen() + prefixLen); bytesProcessed += lastProcessed = result.getBytesProcessed(); D specific = (D) SpecificData.get().deepCopy( result.getValue().getSchema(), result.getValue()); if (log.isDebugEnabled()) { log.debug("Avro record=" + specific.toString()); } return specific; } catch (IOException e) { throw new AvroRuntimeException(e); } }
/** * Convert host data to a JAXB instance. * <p/> * * @param hostData the buffer of host data * @param start where to start in the buffer of host data * @param length How many bytes of hostData contains actual data to process * @return a result object containing the JAXB instance created as well as * the total number of host bytes used to generate that JAXB * instance */ public FromHostResult < J > convert(byte[] hostData, int start, int length) { Cob2JaxbVisitor visitor = new Cob2JaxbVisitor(getCobolContext(), hostData, start, length, jaxbWrapperFactory); visitor.visit(getCobolComplexType()); JaxbWrapper < ? > jaxbWrapper = visitor .getLastObject(JaxbWrapper.class); return new FromHostResult < J >(visitor.getLastPos(), jaxbClass.cast(jaxbWrapper.getJaxb())); }
public B cobolComplexType(CobolComplexType cobolComplexType) { this.cobolComplexType = cobolComplexType; return self(); }
public B customVariables(Set < String > customVariables) { this.customVariables = customVariables; return self(); }
public B cobolContext(CobolContext cobolContext) { this.cobolContext = cobolContext; return self(); }