com.univocity.parsers.common.processor
Interface RowWriterProcessor<T>

Type Parameters:
T - the type that is converted by this implementation into an Object array, suitable for writing to the output.
All Known Implementing Classes:
BeanWriterProcessor, ObjectRowWriterProcessor, OutputValueSwitch, RowWriterProcessorSwitch

public interface RowWriterProcessor<T>

The essential callback interface to convert input objects into a manageable format for writing. Used by any writer that extends AbstractWriter.

When writing to an output, the writer will obtain the RowWriterProcessor from CommonWriterSettings.getRowWriterProcessor(), and invoke write(Object, String[], int[]) to convert the input to an array of objects. This array of objects will in turn be handed to the writer to produce a record in the expected format.

uniVocity-parsers provides some useful default implementations of this interface in the package com.univocity.parsers.common.processor, namely:

Author:
uniVocity Software Pty Ltd - [email protected]
See Also:
AbstractWriter, CommonWriterSettings

Method Summary
 Object[] write(T input, String[] headers, int[] indexesToWrite)
          Converts the given input into an Object array that is suitable for writing.
 

Method Detail

write

Object[] write(T input,
               String[] headers,
               int[] indexesToWrite)
Converts the given input into an Object array that is suitable for writing. Used by format-specific writers that extend AbstractWriter.

Parameters:
input - The original input record that must be converted into an Object array before writing to an output.
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 Object array that is suitable for writing. If null or an empty array is returned then the writer might either skip this value or write an empty record (if CommonSettings.getSkipEmptyLines() is false)
See Also:
CsvWriter, FixedWidthWriter, CommonSettings, AbstractWriter


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