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

public abstract Class AbstractMultiBeanRowProcessor<C extends Context>

extends AbstractMultiBeanProcessor<C extends Context>
Class Inheritance
Known Direct Subclasses
com.univocity.parsers.common.processor.MultiBeanRowProcessor, com.univocity.parsers.common.processor.core.AbstractMultiBeanListProcessor
Imports
com.univocity.parsers.common.*, java.util.*

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

The class types passed to the constructor of this class must contain the annotations provided in com.univocity.parsers.annotations.

For each row processed, one or more java bean instances of any given class will be created with their fields populated.

Once all beans are populated from an individual input record, they will be sent to through the AbstractMultiBeanRowProcessor#rowProcessed(Map, Context) method, where the user can access all beans parsed for that row.

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

Field Summary

Modifier and TypeField and Description
private long
private final HashMap<Class<?>, Object>

Constructor Summary

AccessConstructor and Description
public
AbstractMultiBeanRowProcessor(Class<T>...
the classes with their attributes mapped to fields of records parsed by an AbstractParser or written by an AbstractWriter.
beanTypes
)

Creates a processor for java beans of multiple types

Method Summary

Modifier and TypeMethod and Description
public final void
beanProcessed(Class<?>
the type of the object created by the parser using the information collected for an individual record.
beanType
,
Object
java object created with the information extracted by the parser for an individual record.
beanInstance
,
C
A contextual object with information and controls over the current state of the parsing process
context
)

Implements abstract com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor.beanProcessed.

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
)

Overrides com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor.processEnded.

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
)

Overrides com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor.processStarted.

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.
protected abstract void
rowProcessed(Map<Class<?>, Object>
a map containing all object instances generated from an input row. The map is reused internally. Make a copy if you want to keep the map.
row
,
C
A contextual object with information and controls over the current state of the parsing process
context
)

Invoked by the processor after all beans of a valid record have been processed.

private void
submitRow(C context)

Inherited from com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor:
convertAllconvertFieldsconvertIndexesconvertTypegetBeanClassesgetProcessorOfTyperowProcessed

Field Detail

recordback to summary
private long record
rowback to summary
private final HashMap<Class<?>, Object> row

Constructor Detail

AbstractMultiBeanRowProcessorback to summary
public AbstractMultiBeanRowProcessor(Class<T>... beanTypes)

Creates a processor for java beans of multiple types

Parameters
beanTypes:Class<T>[]

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

Method Detail

beanProcessedback to summary
public final void beanProcessed(Class<?> beanType, Object beanInstance, C context)

Implements abstract com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor.beanProcessed.

Doc from com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor.beanProcessed.

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

Parameters
beanType:Class<?>

the type of the object created by the parser using the information collected for an individual record.

beanInstance:Object

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

Annotations
@Override
processEndedback to summary
public void processEnded(C context)

Overrides com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor.processEnded.

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)

Overrides com.univocity.parsers.common.processor.core.AbstractMultiBeanProcessor.processStarted.

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

rowProcessedback to summary
protected abstract void rowProcessed(Map<Class<?>, Object> row, C context)

Invoked by the processor after all beans of a valid record have been processed.

Parameters
row:Map<Class<?>, Object>

a map containing all object instances generated from an input row. The map is reused internally. Make a copy if you want to keep the map.

context:C

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

submitRowback to summary
private void submitRow(C context)