Package net.sf.anupam.csv
Class CSVParserFactory
java.lang.Object
net.sf.anupam.csv.CSVParserFactory
Singleton factory for creating the
CSVParser parser objects
for clients of the framework. This factory uses the
csv-mapping.xml mapping configuration to create CSV parsers
customized for the POJO bean to parse. This is the first interface for
clients of the framework.- Since:
- 1.8
- Version:
- $Revision$
- Author:
- Anupam Sengupta
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetBeanMapping(String beanName) Returns the requested bean mapping configuration.getCSVParser(String mappingName, Reader csvReader) Returns a new CSV file parser for the specified mapping and the specified CSV reader stream.getCSVParser(String mappingName, String csvFileName, boolean inClassPath) Returns a new CSV file parser for the specified mapping, and the specified CSV file.static CSVParserFactoryReturns the singleton instance of this factory.
-
Method Details
-
getSingleton
Returns the singleton instance of this factory.- Returns:
- the singleton parser factory
- Throws:
CSVOException- thrown if the singleton cannot be created
-
getBeanMapping
Returns the requested bean mapping configuration.- Parameters:
beanName- the POJO bean for which the mapping is to be returned- Returns:
- the CSV bean mapping, or
nullif not found
-
getCSVParser
public CSVParser getCSVParser(String mappingName, String csvFileName, boolean inClassPath) throws FileNotFoundException Returns a new CSV file parser for the specified mapping, and the specified CSV file.- Parameters:
mappingName- the CSV mapping to for which the parser should be createdcsvFileName- the CSV file to be parsedinClassPath- indicates whether the CSV file is in the classpath- Returns:
- the CSV Parser, or
nullif not found - Throws:
FileNotFoundException- thrown if the specified CSV file cannot be found- See Also:
-
getCSVParser
Returns a new CSV file parser for the specified mapping and the specified CSV reader stream.- Parameters:
mappingName- the CSV mapping for which the parser should be returnedcsvReader- the CSV stream to parse- Returns:
- the CSV Parser, or
nullif not found - See Also:
-