DataType
- The type provided by this data sourcepublic abstract class AbstractCsvDataSource<DataType> extends AbstractDataSource<org.springframework.core.io.Resource,org.apache.commons.csv.CSVRecord,DataType>
AbstractCsvDataSource
acts as base class for csv file data sources. It is based on Resource
as selector type.
The DataSource.canHandle(Object)
methods checks for "csv" as file extension.
This class uses CSVFormat
for parsing the csv file.
Constructor and Description |
---|
AbstractCsvDataSource() |
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(org.springframework.core.io.Resource resource)
This method is called by the framework in order to determine if the DataSource is able to provide data based on the given
selector.
|
protected Iterator<org.apache.commons.csv.CSVRecord> |
getIterator(org.springframework.core.io.Resource resource)
Returns an iterator which traverses the source data types.
|
Class<org.springframework.core.io.Resource> |
getSelectorType()
This method is called when a suitable DataSource is determined.
|
getData, mapDataSet
public boolean canHandle(org.springframework.core.io.Resource resource)
DataSource
DataSource.getData(Object)
is called in order to obtain the data.
canHandle is only called if the the selector is compatible with the Class returned by DataSource.getSelectorType()
.
Concrete data sources should rather extend AbstractDataSource
than implementing this interface directly.
resource
- the selector which is used to determine the data to be providedpublic Class<org.springframework.core.io.Resource> getSelectorType()
DataSource
protected Iterator<org.apache.commons.csv.CSVRecord> getIterator(org.springframework.core.io.Resource resource)
AbstractDataSource
AbstractDataSource.mapDataSet(Object)
.getIterator
in class AbstractDataSource<org.springframework.core.io.Resource,org.apache.commons.csv.CSVRecord,DataType>
resource
- the selector which is used to determine the data to be providedCopyright © 2018–2021 b+m Informatik AG. All rights reserved.