liquibase.util.csv.opencsv.bean
Class CsvToBean<T>

java.lang.Object
  extended by liquibase.util.csv.opencsv.bean.AbstractCSVToBean
      extended by liquibase.util.csv.opencsv.bean.CsvToBean<T>
Type Parameters:
T - - class to convert the objects to.

public class CsvToBean<T>
extends AbstractCSVToBean

Converts CSV data to objects.


Constructor Summary
CsvToBean()
          Default constructor.
 
Method Summary
protected  PropertyEditor getPropertyEditor(PropertyDescriptor desc)
          Attempt to find custom property editor on descriptor first, else try the propery editor manager.
 List<T> parse(MappingStrategy<T> mapper, CSVReader csv)
          parse the values from the csvReader.
 List<T> parse(MappingStrategy<T> mapper, CSVReader csv, CsvToBeanFilter filter)
          parse the values from the csvReader.
 List<T> parse(MappingStrategy<T> mapper, Reader reader)
          parse the values from a csvReader constructed from the passed in Reader.
 List<T> parse(MappingStrategy<T> mapper, Reader reader, CsvToBeanFilter filter)
          parse the values from a csvReader constructed from the passed in Reader.
protected  T processLine(MappingStrategy<T> mapper, String[] line)
          Creates a single object from a line from the csv file.
 
Methods inherited from class liquibase.util.csv.opencsv.bean.AbstractCSVToBean
checkForTrim, convertValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvToBean

public CsvToBean()
Default constructor.

Method Detail

parse

public List<T> parse(MappingStrategy<T> mapper,
                     Reader reader)
parse the values from a csvReader constructed from the passed in Reader.

Parameters:
mapper - - mapping strategy for the bean.
reader - - Reader used to construct a CSVReader
Returns:
List of Objects.

parse

public List<T> parse(MappingStrategy<T> mapper,
                     Reader reader,
                     CsvToBeanFilter filter)
parse the values from a csvReader constructed from the passed in Reader.

Parameters:
mapper - - mapping strategy for the bean.
reader - - Reader used to construct a CSVReader
filter - - CsvToBeanFilter to apply - null if no filter.
Returns:
List of Objects.

parse

public List<T> parse(MappingStrategy<T> mapper,
                     CSVReader csv)
parse the values from the csvReader.

Parameters:
mapper - - mapping strategy for the bean.
csv - - CSVReader
Returns:
List of Objects.

parse

public List<T> parse(MappingStrategy<T> mapper,
                     CSVReader csv,
                     CsvToBeanFilter filter)
parse the values from the csvReader.

Parameters:
mapper - - mapping strategy for the bean.
csv - - CSVReader
filter - - CsvToBeanFilter to apply - null if no filter.
Returns:
List of Objects.

processLine

protected T processLine(MappingStrategy<T> mapper,
                        String[] line)
                 throws IllegalAccessException,
                        InvocationTargetException,
                        InstantiationException,
                        IntrospectionException
Creates a single object from a line from the csv file.

Parameters:
mapper - - MappingStrategy
line - - array of Strings from the csv file.
Returns:
- object containing the values.
Throws:
IllegalAccessException - - thrown on error creating bean.
InvocationTargetException - - thrown on error calling the setters.
InstantiationException - - thrown on error creating bean.
IntrospectionException - - thrown on error getting the PropertyDescriptor.

getPropertyEditor

protected PropertyEditor getPropertyEditor(PropertyDescriptor desc)
                                    throws InstantiationException,
                                           IllegalAccessException
Attempt to find custom property editor on descriptor first, else try the propery editor manager.

Specified by:
getPropertyEditor in class AbstractCSVToBean
Parameters:
desc - - PropertyDescriptor.
Returns:
- the PropertyEditor for the given PropertyDescriptor.
Throws:
InstantiationException - - thrown when getting the PropertyEditor for the class.
IllegalAccessException - - thrown when getting the PropertyEditor for the class.


Copyright © 2016 Liquibase.org. All rights reserved.