CSVObjects Framework

net.sf.anupam.csv
Class CSVParserFactory

java.lang.Object
  extended by net.sf.anupam.csv.CSVParserFactory

public final class CSVParserFactory
extends Object

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.5
Version:
$Revision: 1.3 $
Author:
Anupam Sengupta
See Also:
CSVParser

Method Summary
 CSVBeanMapping getBeanMapping(String beanName)
          Returns the requested bean mapping configuration.
 CSVParser getCSVParser(String mappingName, Reader csvReader)
          Returns a new CSV file parser for the specified mapping and the specified CSV reader stream.
 CSVParser getCSVParser(String mappingName, String csvFileName, boolean inClassPath)
          Returns a new CSV file parser for the specified mapping, and the specified CSV file.
static CSVParserFactory getSingleton()
          Returns the singleton instance of this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSingleton

public static CSVParserFactory getSingleton()
                                     throws CSVOException
Returns the singleton instance of this factory.

Returns:
the singleton parser factory
Throws:
CSVOException - thrown if the singleton cannot be created

getBeanMapping

public CSVBeanMapping getBeanMapping(String beanName)
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 null if 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 created
csvFileName - the CSV file to be parsed
inClassPath - indicates whether the CSV file is in the classpath
Returns:
the CSV Parser, or null if not found
Throws:
FileNotFoundException - thrown if the specified CSV file cannot be found
See Also:
getCSVParser(String,java.io.Reader)

getCSVParser

public CSVParser getCSVParser(String mappingName,
                              Reader csvReader)
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 returned
csvReader - the CSV stream to parse
Returns:
the CSV Parser, or null if not found
See Also:
getCSVParser(String,String,boolean)

SourceForge.net Logo

© Anupam Sengupta 2005