|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.parsers.common.DefaultConversionProcessor
com.univocity.parsers.common.processor.core.BeanConversionProcessor<T>
com.univocity.parsers.common.processor.core.AbstractBeanProcessor<T,C>
T - the annotated class type.public abstract class AbstractBeanProcessor<T,C extends Context>
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 beanProcessed(Object, Context) method, where the user can access it.
AbstractParser,
Processor| Field Summary |
|---|
| Fields inherited from class com.univocity.parsers.common.processor.core.BeanConversionProcessor |
|---|
initialized, methodFilter, parsedFields, transformer |
| Constructor Summary | |
|---|---|
AbstractBeanProcessor(Class<T> beanType,
MethodFilter methodFilter)
Creates a processor for java beans of a given type. |
|
| Method Summary | |
|---|---|
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. |
void |
processEnded(C context)
This method will by invoked by the parser once, after the parsing process stopped and all resources were closed. |
void |
processStarted(C context)
This method will by invoked by the parser once, when it is ready to start processing the input. |
void |
rowProcessed(String[] row,
C context)
Converts a parsed row to a java object |
| Methods inherited from class com.univocity.parsers.common.processor.core.BeanConversionProcessor |
|---|
addConversion, createBean, getBeanClass, initialize, initialize, isStrictHeaderValidationEnabled, processField, reverseConversions, setStrictHeaderValidationEnabled |
| Methods inherited from class com.univocity.parsers.common.DefaultConversionProcessor |
|---|
applyConversions, convertAll, convertFields, convertIndexes, convertType, handleConversionError, initializeConversions, reverseConversions, toDataProcessingException |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractBeanProcessor(Class<T> beanType,
MethodFilter methodFilter)
beanType - the class with its attributes mapped to fields of records parsed by an AbstractParser or written by an AbstractWriter.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 |
|---|
public final void rowProcessed(String[] row,
C context)
rowProcessed in interface Processor<C extends Context>row - the data extracted by the parser for an individual record. Note that:
CommonSettings.setSkipEmptyLines(boolean)Format.setComment(char) to '\0'context - A contextual object with information and controls over the current state of the parsing process
public abstract void beanProcessed(T bean,
C context)
bean - java object created with the information extracted by the parser for an individual record.context - A contextual object with information and controls over the current state of the parsing processpublic void processStarted(C context)
Processor
processStarted in interface Processor<C extends Context>context - A contextual object with information and controls over the current state of the parsing processpublic void processEnded(C context)
Processor 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 Context.stop().
processEnded in interface Processor<C extends Context>context - A contextual object with information and controls over the state of the parsing process
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||