liquibase.util.csv.opencsv.bean
Class AbstractCSVToBean

java.lang.Object
  extended by liquibase.util.csv.opencsv.bean.AbstractCSVToBean
Direct Known Subclasses:
CsvToBean

public abstract class AbstractCSVToBean
extends Object

Converts CSV data to objects.


Constructor Summary
AbstractCSVToBean()
           
 
Method Summary
protected  String checkForTrim(String s, PropertyDescriptor prop)
          Returns the trimmed value of the string only if the property the string is describing should be trimmed to be converted to that type.
protected  Object convertValue(String value, PropertyDescriptor prop)
          Convert a string value to its Object value.
protected abstract  PropertyEditor getPropertyEditor(PropertyDescriptor desc)
          Attempt to find custom property editor on descriptor first, else try the propery editor manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCSVToBean

public AbstractCSVToBean()
Method Detail

getPropertyEditor

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

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.

checkForTrim

protected String checkForTrim(String s,
                              PropertyDescriptor prop)
Returns the trimmed value of the string only if the property the string is describing should be trimmed to be converted to that type.

Parameters:
s - - String describing the value.
prop - - property descriptor of the value.
Returns:
the string passed in if the property is a string otherwise it will return the string with the beginning and end whitespace removed.

convertValue

protected Object convertValue(String value,
                              PropertyDescriptor prop)
                       throws InstantiationException,
                              IllegalAccessException
Convert a string value to its Object value.

Parameters:
value - - String value
prop - - PropertyDescriptor
Returns:
The object set to value (i.e. Integer). Will return String if no PropertyEditor is found.
Throws:
InstantiationException - - Thrown on error getting the property editor from the property descriptor.
IllegalAccessException - - Thrown on error getting the property editor from the property descriptor.


Copyright © 2016 Liquibase.org. All rights reserved.