Top Description Fields Constructors Methods
com.univocity.parsers.common.processor

public Class BeanWriterProcessor<T>

extends BeanConversionProcessor<T>
implements RowWriterProcessor<T>
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.common.processor.RowWriterProcessor
Type Parameters
<T>
the annotated class type.
Imports
com.univocity.parsers.annotations.helpers.*, com.univocity.parsers.common.*, com.univocity.parsers.common.fields.*, com.univocity.parsers.common.processor.core.*, com.univocity.parsers.conversions.*

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 - [email protected]
See Also
AbstractWriter, RowWriterProcessor, BeanConversionProcessor

Field Summary

Modifier and TypeField and Description
private NormalizedString[]
private String[]
Inherited from com.univocity.parsers.common.processor.core.BeanConversionProcessor:
initializedmethodFilterparsedFieldstransformer

Constructor Summary

AccessConstructor and Description
public
BeanWriterProcessor(Class<T>
the class annotated with one or more of the annotations provided in com.univocity.parsers.annotations.
beanType
)

Initializes the BeanWriterProcessor with the annotated bean class

Method Summary

Modifier and TypeMethod and Description
protected FieldConversionMapping
cloneConversions()

Overrides com.univocity.parsers.common.processor.core.BeanConversionProcessor.cloneConversions.

Creates a copy of the manually defined conversions to be applied over any columns.
public Object[]

Returns:

a row of objects containing the values extracted from the java bean
write
(T
an instance of the type defined in this class constructor.
input
,
String[]
All field names used to produce records in a given destination. May be null if no headers have been defined in CommonSettings#getHeaders()
headers
,
int[]
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...)
indexesToWrite
)

Converts the java bean instance into a sequence of values for writing.

public Object[]

Returns:

a row of objects containing the values extracted from the java bean
write
(T
an instance of the type defined in this class constructor.
input
,
NormalizedString[]
All field names used to produce records in a given destination. May be null if no headers have been defined in CommonSettings#getHeaders()
headers
,
int[]
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...)
indexesToWrite
)

Implements com.univocity.parsers.common.processor.RowWriterProcessor.write.

Converts the java bean instance into a sequence of values for writing.
Inherited from com.univocity.parsers.common.processor.core.BeanConversionProcessor:
addConversioncreateBeangetBeanClassgetColumnMapperinitializeinitializeinitializeisStrictHeaderValidationEnabledprocessFieldreverseConversionssetColumnMappersetStrictHeaderValidationEnabled

Field Detail

normalizedHeadersback to summary
private NormalizedString[] normalizedHeaders
previousHeadersback to summary
private String[] previousHeaders

Constructor Detail

BeanWriterProcessorback to summary
public BeanWriterProcessor(Class<T> beanType)

Initializes the BeanWriterProcessor with the annotated bean class

Parameters
beanType:Class<T>

the class annotated with one or more of the annotations provided in com.univocity.parsers.annotations.

Method Detail

cloneConversionsback to summary
protected FieldConversionMapping cloneConversions()

Overrides com.univocity.parsers.common.processor.core.BeanConversionProcessor.cloneConversions.

Doc from com.univocity.parsers.common.processor.core.BeanConversionProcessor.cloneConversions.

Creates a copy of the manually defined conversions to be applied over any columns.

Returns:FieldConversionMapping

a copy of the currently defined conversions

Annotations
@Override
writeback to summary
public Object[] write(T input, String[] headers, int[] indexesToWrite)

Converts the java bean instance into a sequence of values for writing.

Parameters
input:T

an instance of the type defined in this class constructor.

headers:String[]

All field names used to produce records in a given destination. May be null if no headers have been defined in CommonSettings#getHeaders()

indexesToWrite:int[]

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:Object[]

a row of objects containing the values extracted from the java bean

writeback to summary
public Object[] write(T input, NormalizedString[] headers, int[] indexesToWrite)

Implements com.univocity.parsers.common.processor.RowWriterProcessor.write.

Converts the java bean instance into a sequence of values for writing.

Parameters
input:T

an instance of the type defined in this class constructor.

headers:NormalizedString[]

All field names used to produce records in a given destination. May be null if no headers have been defined in CommonSettings#getHeaders()

indexesToWrite:int[]

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:Object[]

a row of objects containing the values extracted from the java bean

Annotations
@Override