com.univocity.parsers.common.processor
Class ObjectRowWriterProcessor

java.lang.Object
  extended by com.univocity.parsers.common.DefaultConversionProcessor
      extended by com.univocity.parsers.common.processor.ObjectRowWriterProcessor
All Implemented Interfaces:
ConversionProcessor, RowWriterProcessor<Object[]>

public class ObjectRowWriterProcessor
extends DefaultConversionProcessor
implements RowWriterProcessor<Object[]>

A RowWriterProcessor implementation for executing conversion sequences in object arrays before for writing them using any implementation of AbstractWriter.

Author:
uniVocity Software Pty Ltd - parsers@univocity.com
See Also:
AbstractWriter, RowWriterProcessor

Constructor Summary
ObjectRowWriterProcessor()
           
 
Method Summary
 Object[] write(Object[] input, String[] headers, int[] indexesToWrite)
          Executes the sequences of conversions defined using DefaultConversionProcessor.convertFields(Conversion...), DefaultConversionProcessor.convertIndexes(Conversion...) and DefaultConversionProcessor.convertAll(Conversion...), for every field in the given row.
 
Methods inherited from class com.univocity.parsers.common.DefaultConversionProcessor
applyConversions, convertAll, convertFields, convertIndexes, convertType, handleConversionError, initializeConversions, reverseConversions, toDataProcessingException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectRowWriterProcessor

public ObjectRowWriterProcessor()
Method Detail

write

public Object[] write(Object[] input,
                      String[] headers,
                      int[] indexesToWrite)
Executes the sequences of conversions defined using DefaultConversionProcessor.convertFields(Conversion...), DefaultConversionProcessor.convertIndexes(Conversion...) and DefaultConversionProcessor.convertAll(Conversion...), for every field in the given row.

Each field will be transformed using the Conversion.execute(Object) method.

In general the conversions will process a String and convert it to some object value (such as booleans, dates, etc).

Specified by:
write in interface RowWriterProcessor<Object[]>
Parameters:
input - the object array that represents a record with its individual fields.
headers - All field names used to produce records in a given destination. May be null if no headers have been defined in CommonSettings.getHeaders()
indexesToWrite - The indexes of the headers that are actually being written. May be null if no fields have been selected using CommonSettings.selectFields(String...) or CommonSettings.selectIndexes(Integer...)
Returns:
an row of Object instances containing the values obtained after the execution of all conversions.

Fields that do not have any conversion defined will just be copied to the object array into their original positions.

See Also:
CsvWriter, FixedWidthWriter, CommonSettings, AbstractWriter


Copyright © 2017 uniVocity Software Pty Ltd. All rights reserved.