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>
A
RowWriterProcessor
implementation for converting annotated java objects into object arrays suitable for writing in any implementation of AbstractWriter
.
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.
-
Field Summary
FieldsFields inherited from class com.univocity.parsers.common.processor.core.BeanConversionProcessor
initialized, methodFilter, parsedFields, transformer
Fields inherited from class com.univocity.parsers.common.DefaultConversionProcessor
conversions
-
Constructor Summary
ConstructorsConstructorDescriptionBeanWriterProcessor
(Class<T> beanType) Initializes the BeanWriterProcessor with the annotated bean class -
Method Summary
Modifier and TypeMethodDescriptionprotected FieldConversionMapping
Creates a copy of the manually defined conversions to be applied over any columns.Object[]
write
(T input, NormalizedString[] headers, int[] indexesToWrite) Converts the java bean instance into a sequence of values for writing.Object[]
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, getColumnMapper, initialize, initialize, initialize, isStrictHeaderValidationEnabled, processField, reverseConversions, setColumnMapper, setStrictHeaderValidationEnabled
Methods inherited from class com.univocity.parsers.common.DefaultConversionProcessor
applyConversions, convertAll, convertFields, convertIndexes, convertType, handleConversionError, initializeConversions, reverseConversions, toDataProcessingException
-
Field Details
-
normalizedHeaders
-
previousHeaders
-
-
Constructor Details
-
BeanWriterProcessor
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 Details
-
write
Converts the java bean instance into a sequence of values for writing.- 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
-
write
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:
-
cloneConversions
Description copied from class:BeanConversionProcessor
Creates a copy of the manually defined conversions to be applied over any columns.- Overrides:
cloneConversions
in classBeanConversionProcessor<T>
- Returns:
- a copy of the currently defined conversions
-