T - the annotated class type.public abstract class AbstractBeanListProcessor<T,C extends Context> extends AbstractBeanProcessor<T,C>
Processor implementation for storing all java objects generated form the parsed input into a list.
A typical use case of this class will be:
parserSettings.setRowProcessor(new BeanListProcessor(MyObject.class)); parser.parse(reader); // will invoke the {@link AbstractBeanListProcessor#beanProcessed(Object, C)} method for each generated object. List<T> beans = rowProcessor.getBeans();
Processor,
AbstractParser,
AbstractBeanProcessor,
BeanConversionProcessorinitialized, methodFilter, parsedFields, transformerconversions| Constructor and Description |
|---|
AbstractBeanListProcessor(Class<T> beanType)
Creates a processor that stores java beans of a given type into a list
|
AbstractBeanListProcessor(Class<T> beanType,
int expectedBeanCount)
Creates a processor that stores java beans of a given type into a list
|
| Modifier and Type | Method and Description |
|---|---|
void |
beanProcessed(T bean,
C context)
Stores the generated java bean produced with a parsed record into a list.
|
List<T> |
getBeans()
Returns the list of generated java beans at the end of the parsing process.
|
String[] |
getHeaders()
Returns the record headers.
|
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.
|
rowProcessedaddConversion, cloneConversions, createBean, getBeanClass, getColumnMapper, initialize, initialize, initialize, isStrictHeaderValidationEnabled, processField, reverseConversions, setColumnMapper, setStrictHeaderValidationEnabledapplyConversions, convertAll, convertFields, convertIndexes, convertType, handleConversionError, initializeConversions, reverseConversions, toDataProcessingExceptionpublic AbstractBeanListProcessor(Class<T> beanType)
beanType - the class with its attributes mapped to fields of records parsed by an AbstractParser or written by an AbstractWriter.public AbstractBeanListProcessor(Class<T> beanType, int expectedBeanCount)
beanType - the class with its attributes mapped to fields of records parsed by an AbstractParser or written by an AbstractWriter.expectedBeanCount - expected number of rows to be parsed from the input which will be converted into java beans.
Used to pre-allocate the size of the output List returned by getBeans()public void beanProcessed(T bean, C context)
beanProcessed in class AbstractBeanProcessor<T,C extends Context>bean - java bean generated with the information extracted by the parser for an individual recordcontext - A contextual object with information and controls over the current state of the parsing processBeanProcessorpublic List<T> getBeans()
public void processStarted(C context)
ProcessorprocessStarted in interface Processor<C extends Context>processStarted in class AbstractBeanProcessor<T,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>processEnded in class AbstractBeanProcessor<T,C extends Context>context - A contextual object with information and controls over the state of the parsing processpublic String[] getHeaders()
CommonSettings.getHeaders() or the headers parsed in the file when CommonSettings.getHeaders() equals trueCopyright © 2019 Univocity Software Pty Ltd. All rights reserved.