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

public abstract Class AbstractBeanProcessor<T, C extends Context>

extends BeanConversionProcessor<T>
implements Processor<C extends Context>
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.common.processor.core.Processor
Known Direct Subclasses
com.univocity.parsers.common.processor.BeanProcessor, com.univocity.parsers.common.processor.core.AbstractBeanListProcessor
Type Parameters
<T>
the annotated class type.
Imports
com.univocity.parsers.annotations.*, com.univocity.parsers.annotations.helpers.*, com.univocity.parsers.common.*

A Processor implementation for converting rows extracted from any implementation of AbstractParser into java objects.

The class type of the object must contain the annotations provided in com.univocity.parsers.annotations.

For each row processed, a java bean instance of a given class will be created with its fields populated.

This instance will then be sent to the AbstractBeanProcessor#beanProcessed(Object, Context) method, where the user can access it.

Author
Univocity Software Pty Ltd - [email protected]
See Also
AbstractParser, Processor

Field Summary

Inherited from com.univocity.parsers.common.processor.core.BeanConversionProcessor:
beanClassconstructorinitializedmethodFilterparsedFieldsstrictHeaderValidationEnabledtransformer

Constructor Summary

AccessConstructor and Description
public
AbstractBeanProcessor(Class<T>
the class with its attributes mapped to fields of records parsed by an AbstractParser or written by an AbstractWriter.
beanType
,
MethodFilter
filter to apply over annotated methods when the processor is reading data from beans (to write values to an output) or writing values into beans (when parsing). It is used to choose either a "get" or a "set" method annotated with Parsed, when both methods target the same field.
methodFilter
)

Creates a processor for java beans of a given type.

Method Summary

Modifier and TypeMethod and Description
public abstract void
beanProcessed(T
java object created with the information extracted by the parser for an individual record.
bean
,
C
A contextual object with information and controls over the current state of the parsing process
context
)

Invoked by the processor after all values of a valid record have been processed and converted into a java object.

public void
processEnded(C
A contextual object with information and controls over the state of the parsing process
context
)

Implements com.univocity.parsers.common.processor.core.Processor.processEnded.

This method will by invoked by the parser once, after the parsing process stopped and all resources were closed.
public void
processStarted(C
A contextual object with information and controls over the current state of the parsing process
context
)

Implements com.univocity.parsers.common.processor.core.Processor.processStarted.

This method will by invoked by the parser once, when it is ready to start processing the input.
public final void
rowProcessed(String[]
the data extracted by the parser for an individual record. Note that:
row
,
C
A contextual object with information and controls over the current state of the parsing process
context
)

Implements com.univocity.parsers.common.processor.core.Processor.rowProcessed.

Converts a parsed row to a java object
Inherited from com.univocity.parsers.common.processor.core.BeanConversionProcessor:
addConversioncloneConversionscreateBeancreateNestedProcessordescribeFieldgetBeanClassgetColumnMappergetNestedAttributesinitializeinitializeinitializeisStrictHeaderValidationEnabledmapValuesToFieldsprocessFieldprocessFieldprocessNestedAttributesreverseConversionssetColumnMappersetStrictHeaderValidationEnabledvalidateMappings

Constructor Detail

AbstractBeanProcessorback to summary
public AbstractBeanProcessor(Class<T> beanType, MethodFilter methodFilter)

Creates a processor for java beans of a given type.

Parameters
beanType:Class<T>

the class with its attributes mapped to fields of records parsed by an AbstractParser or written by an AbstractWriter.

methodFilter:MethodFilter

filter to apply over annotated methods when the processor is reading data from beans (to write values to an output) or writing values into beans (when parsing). It is used to choose either a "get" or a "set" method annotated with Parsed, when both methods target the same field.

Method Detail

beanProcessedback to summary
public abstract void beanProcessed(T bean, C context)

Invoked by the processor after all values of a valid record have been processed and converted into a java object.

Parameters
bean:T

java object created with the information extracted by the parser for an individual record.

context:C

A contextual object with information and controls over the current state of the parsing process

processEndedback to summary
public void processEnded(C context)

Implements com.univocity.parsers.common.processor.core.Processor.processEnded.

Doc from com.univocity.parsers.common.processor.core.Processor.processEnded.

This method will by invoked by the parser once, after the parsing process stopped and all resources were closed.

It will always be called by the parser: in case of errors, if the end of the input us reached, or if the user stopped the process manually using ParsingContext#stop().

Parameters
context:C

A contextual object with information and controls over the state of the parsing process

Annotations
@Override
processStartedback to summary
public void processStarted(C context)

Implements com.univocity.parsers.common.processor.core.Processor.processStarted.

Doc from com.univocity.parsers.common.processor.core.Processor.processStarted.

This method will by invoked by the parser once, when it is ready to start processing the input.

Parameters
context:C

A contextual object with information and controls over the current state of the parsing process

Annotations
@Override
rowProcessedback to summary
public final void rowProcessed(String[] row, C context)

Implements com.univocity.parsers.common.processor.core.Processor.rowProcessed.

Converts a parsed row to a java object

Parameters
row:String[]

Doc from com.univocity.parsers.common.processor.core.Processor.rowProcessed.

the data extracted by the parser for an individual record. Note that:

context:C

Doc from com.univocity.parsers.common.processor.core.Processor.rowProcessed.

A contextual object with information and controls over the current state of the parsing process

Annotations
@Override