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, BeanConversionProcessor
| Modifier and Type | Field and Description |
|---|---|
| private List | |
| private final int | |
| private String[] |
| Access | Constructor and Description |
|---|---|
| public | AbstractBeanListProcessor(Class<T>
the class with its attributes mapped to fields of records parsed by an beanType)AbstractParser or written by an AbstractWriter.Creates a processor that stores java beans of a given type into a list |
| public | AbstractBeanListProcessor(Class<T>
the class with its attributes mapped to fields of records parsed by an beanType, int AbstractParser or written by an AbstractWriter.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 expectedBeanCount)List returned by getBeans()Creates a processor that stores java beans of a given type into a list |
| Modifier and Type | Method and Description |
|---|---|
| public void | beanProcessed(T
java bean generated 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)Implements abstract com. |
| public List | Returns: the list of generated java beans at the end of the parsing process.Returns the list of generated java beans at the end of the parsing process. |
| public String[] | |
| public void | processEnded(C
A contextual object with information and controls over the state of the parsing process context)Overrides com. Implements com. |
| public void | processStarted(C
A contextual object with information and controls over the current state of the parsing process context)Overrides com. Implements com. |
| beans | back to summary |
|---|---|
| private List<T> beans | |
| expectedBeanCount | back to summary |
|---|---|
| private final int expectedBeanCount | |
| headers | back to summary |
|---|---|
| private String[] headers | |
| AbstractBeanListProcessor | back to summary |
|---|---|
| public AbstractBeanListProcessor(Class<T> beanType) Creates a processor that stores java beans of a given type into a list
| |
| AbstractBeanListProcessor | back to summary |
|---|---|
| public AbstractBeanListProcessor(Class<T> beanType, int expectedBeanCount) Creates a processor that stores java beans of a given type into a list
| |
| beanProcessed | back to summary |
|---|---|
| public void beanProcessed(T bean, C context) Implements abstract com. Stores the generated java bean produced with a parsed record into a list.
| |
| getBeans | back to summary |
|---|---|
| public List Returns the list of generated java beans at the end of the parsing process.
| |
| getHeaders | back to summary |
|---|---|
| public String[] getHeaders() Returns the record headers. This can be either the headers defined in
| |
| processEnded | back to summary |
|---|---|
| public void processEnded(C context) Overrides com. Implements com. Doc from com. 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
| |
| processStarted | back to summary |
|---|---|
| public void processStarted(C context) Overrides com. Implements com. Doc from com. This method will by invoked by the parser once, when it is ready to start processing the input.
| |