Top Description Fields Constructors Methods
com.opencsv.bean.customconverter

public abstract Class ConverterLanguageToBoolean<T, I>

extends AbstractBeanField<T, I>
Class Inheritance
Known Direct Subclasses
com.opencsv.bean.customconverter.ConvertFrenchToBoolean, com.opencsv.bean.customconverter.ConvertGermanToBoolean
Type Parameters
<T>
Type of the bean to be manipulated
<I>
Type of the index into multivalued fields
Imports
com.opencsv.bean.AbstractBeanField, com.opencsv.exceptions.CsvDataTypeMismatchException, org.apache.commons.beanutils.ConversionException, .Converter, org.apache.commons.beanutils.converters.BooleanConverter, org.apache.commons.lang3.StringUtils, java.util.ResourceBundle

A base class for any converter to and from booleans when the string values have been or should be localized to a specific language.
Author
Andrew Rucker Jones

Field Summary

Inherited from com.opencsv.bean.AbstractBeanField:
convertererrorLocalefieldfieldAccessrequiredtype

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Object

Returns:

Boolean
convert
(String
String that should represent a Boolean
value
)

Implements abstract com.opencsv.bean.AbstractBeanField.convert.

Converts localized text into a Boolean.

protected String

Returns:

Localized text value for "true" or "false"
convertToWrite
(Object value)

Overrides com.opencsv.bean.AbstractBeanField.convertToWrite.

This method takes the current value of the field in question in the bean passed in and converts it to a string.

protected abstract String[]

Returns:

An array of all "false" strings
getAllLocalizedFalseValues
()

This represents a list of all values accepted as "false".

protected abstract String[]

Returns:

An array of all "true" strings
getAllLocalizedTrueValues
()

This represents a list of all values accepted as "true".

protected abstract String

Returns:

The canonical name of false in this language
getLocalizedFalse
()

This is the string for "false" in the localized language.

protected abstract String

Returns:

The canonical name of true in this language
getLocalizedTrue
()

This is the string for "true" in the localized language.

Inherited from com.opencsv.bean.AbstractBeanField:
assignValueToFieldgetErrorLocalegetFieldgetFieldValuegetTypeindexAndSplitMultivaluedFieldisFieldEmptyForWriteisRequiredsetErrorLocalesetFieldsetFieldValuesetRequiredsetTypewrite

Constructor Detail

ConverterLanguageToBooleanback to summary
public ConverterLanguageToBoolean()

Method Detail

convertback to summary
protected Object convert(String value) throws CsvDataTypeMismatchException

Implements abstract com.opencsv.bean.AbstractBeanField.convert.

Converts localized text into a Boolean. The comparisons are case-insensitive.

Parameters
value:String

String that should represent a Boolean

Returns:Object

Boolean

Annotations
@Override
Exceptions
CsvDataTypeMismatchException:
If anything other than the explicitly translated pairs is found
convertToWriteback to summary
protected String convertToWrite(Object value) throws CsvDataTypeMismatchException

Overrides com.opencsv.bean.AbstractBeanField.convertToWrite.

This method takes the current value of the field in question in the bean passed in and converts it to a string. This implementation returns true/false values in the localized language.

Returns:String

Localized text value for "true" or "false"

Annotations
@Override
Exceptions
CsvDataTypeMismatchException:
If the field is not a boolean or Boolean
getAllLocalizedFalseValuesback to summary
protected abstract String[] getAllLocalizedFalseValues()

This represents a list of all values accepted as "false". Any language will have more than one way to say "false", such as "no", "n", or "0". This array should list all possibilities. Comparison is done in a case-insensitive fashion.

Returns:String[]

An array of all "false" strings

getAllLocalizedTrueValuesback to summary
protected abstract String[] getAllLocalizedTrueValues()

This represents a list of all values accepted as "true". Any language will have more than one way to say "true", such as "yes", "y", or "1". This array should list all possibilities. Comparison is done in a case-insensitive fashion.

Returns:String[]

An array of all "true" strings

getLocalizedFalseback to summary
protected abstract String getLocalizedFalse()

This is the string for "false" in the localized language. This value will be used on converting from a boolean to a string.

Returns:String

The canonical name of false in this language

getLocalizedTrueback to summary
protected abstract String getLocalizedTrue()

This is the string for "true" in the localized language. This value will be used on converting from a boolean to a string.

Returns:String

The canonical name of true in this language