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 extendsAbstractWriter
.When writing to an output, the writer will obtain the RowWriterProcessor from
CommonWriterSettings.getRowWriterProcessor()
, and invokewrite(Object, NormalizedString[], 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:ObjectRowWriterProcessor
: used for executing conversions of Object values on input rows using instances ofConversion
before writing to the outputBeanWriterProcessor
: used for converting javabeans annotated with the annotations provided in packagecom.univocity.parsers.annotations
into an object row before writing to the output
- See Also:
AbstractWriter
,CommonWriterSettings
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object[]
write(T input, NormalizedString[] headers, int[] indexesToWrite)
Converts the given input into an Object array that is suitable for writing.
-
-
-
Method Detail
-
write
java.lang.Object[] write(T input, NormalizedString[] headers, int[] indexesToWrite)
Converts the given input into an Object array that is suitable for writing. Used by format-specific writers that extendAbstractWriter
.- 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 inCommonSettings.getHeaders()
indexesToWrite
- The indexes of the headers that are actually being written. May be null if no fields have been selected usingCommonSettings.selectFields(String...)
orCommonSettings.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
-
-