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.
- Author:
- Univocity Software Pty Ltd - parsers@univocity.com
- See Also:
-
Field Summary
Fields inherited from class BeanConversionProcessor
initialized, methodFilter, parsedFields, transformerFields inherited from class DefaultConversionProcessor
conversions -
Constructor Summary
ConstructorsConstructorDescriptionBeanWriterProcessor(Class<T> beanType) Initializes the BeanWriterProcessor with the annotated bean class -
Method Summary
Modifier and TypeMethodDescriptionprotected FieldConversionMappingCreates 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 BeanConversionProcessor
addConversion, createBean, getBeanClass, getColumnMapper, initialize, initialize, initialize, isStrictHeaderValidationEnabled, processField, reverseConversions, setColumnMapper, setStrictHeaderValidationEnabledMethods inherited from class DefaultConversionProcessor
applyConversions, convertAll, convertFields, convertIndexes, convertType, handleConversionError, initializeConversions, reverseConversions, toDataProcessingException
-
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:
writein 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:BeanConversionProcessorCreates a copy of the manually defined conversions to be applied over any columns.- Overrides:
cloneConversionsin classBeanConversionProcessor<T>- Returns:
- a copy of the currently defined conversions
-