Class BeanWriterProcessor<T>
- java.lang.Object
-
- com.univocity.parsers.common.DefaultConversionProcessor
-
- com.univocity.parsers.common.processor.core.BeanConversionProcessor<T>
-
- com.univocity.parsers.common.processor.BeanWriterProcessor<T>
-
- Type Parameters:
T
- the annotated class type.
- All Implemented Interfaces:
ConversionProcessor
,RowWriterProcessor<T>
public class BeanWriterProcessor<T> extends BeanConversionProcessor<T> implements RowWriterProcessor<T>
ARowWriterProcessor
implementation for converting annotated java objects into object arrays suitable for writing in any implementation ofAbstractWriter
.The class type of the object must contain the annotations provided in
com.univocity.parsers.annotations
.For any given java bean instance, this processor will read and convert annotated fields into an object array.
- Author:
- uniVocity Software Pty Ltd - parsers@univocity.com
- See Also:
AbstractWriter
,RowWriterProcessor
,BeanConversionProcessor
-
-
Field Summary
-
Fields inherited from class com.univocity.parsers.common.processor.core.BeanConversionProcessor
initialized, parsedFields
-
-
Constructor Summary
Constructors Constructor Description BeanWriterProcessor(java.lang.Class<T> beanType)
Initializes the BeanWriterProcessor with the annotated bean class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object[]
write(T input, java.lang.String[] headers, int[] indexesToWrite)
Converts the java bean instance into a sequence of values for writing.-
Methods inherited from class com.univocity.parsers.common.processor.core.BeanConversionProcessor
addConversion, createBean, getBeanClass, initialize, initialize, isStrictHeaderValidationEnabled, processField, reverseConversions, setStrictHeaderValidationEnabled
-
Methods inherited from class com.univocity.parsers.common.DefaultConversionProcessor
applyConversions, convertAll, convertFields, convertIndexes, convertType, handleConversionError, initializeConversions, reverseConversions, toDataProcessingException
-
-
-
-
Constructor Detail
-
BeanWriterProcessor
public BeanWriterProcessor(java.lang.Class<T> beanType)
Initializes the BeanWriterProcessor with the annotated bean class- Parameters:
beanType
- the class annotated with one or more of the annotations provided incom.univocity.parsers.annotations
.
-
-
Method Detail
-
write
public java.lang.Object[] write(T input, java.lang.String[] headers, int[] indexesToWrite)
Converts the java bean instance into a sequence of values for writing.- Specified by:
write
in interfaceRowWriterProcessor<T>
- Parameters:
input
- an instance of the type defined in this class constructor.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:
- a row of objects containing the values extracted from the java bean
- See Also:
CsvWriter
,FixedWidthWriter
,CommonSettings
,AbstractWriter
-
-