org.fastnate.data.csv.CsvBooleanConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastnate-data Show documentation
Show all versions of fastnate-data Show documentation
The Fastnate Data Importer for offline SQL generation
package org.fastnate.data.csv;
/**
* Converts a string in a CSV file to a {@link Boolean}.
*
* @author Tobias Liefke
*/
public class CsvBooleanConverter implements CsvPropertyConverter {
@Override
public Boolean convert(final Class extends Boolean> targetType, final String value) {
return value != null && value.matches("(?i)true|1|on|[yj].*|x");
}
}