Top Description Fields Constructors Methods
com.opencsv.bean

public Class ConverterCurrency

extends AbstractCsvConverter
Class Inheritance
Imports
com.opencsv.ICSVParser, com.opencsv.exceptions.CsvDataTypeMismatchException, org.apache.commons.lang3.StringUtils, java.util.Currency, .Locale, .ResourceBundle

This class converts an input ISO 4217 currency code to a java.util.Currency instance.
Author
Andrew Munn
Since
5.3

Field Summary

Inherited from com.opencsv.bean.AbstractCsvConverter:
errorLocalelocaletypewriteLocale

Constructor Summary

AccessConstructor and Description
public
ConverterCurrency(Locale
The locale to use for error messages
errorLocale
)

Initializes the class.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

java.util.Currency instance
convertToRead
(String
The ISO 4217 currency code string to be converted
value
)

Implements com.opencsv.bean.CsvConverter.convertToRead.

Method for converting from a string to the proper data type of the destination field.

public String

Returns:

ISO 4217 currency code or null if value was null
convertToWrite
(Object
The java.util.Currency instance
value
)

Overrides com.opencsv.bean.AbstractCsvConverter.convertToWrite.

Implements com.opencsv.bean.CsvConverter.convertToWrite.

Converts java.util.Currency instance to a string.

Inherited from com.opencsv.bean.AbstractCsvConverter:
setErrorLocalesetLocalesetTypesetWriteLocale

Constructor Detail

ConverterCurrencyback to summary
public ConverterCurrency(Locale errorLocale)

Initializes the class.

Parameters
errorLocale:Locale

The locale to use for error messages

Method Detail

convertToReadback to summary
public Object convertToRead(String value) throws CsvDataTypeMismatchException

Implements com.opencsv.bean.CsvConverter.convertToRead.

Doc from com.opencsv.bean.CsvConverter.convertToRead.

Method for converting from a string to the proper data type of the destination field.

Parameters
value:String

The ISO 4217 currency code string to be converted

Returns:Object

java.util.Currency instance

Annotations
@Override
Exceptions
CsvDataTypeMismatchException:
If the input string cannot be converted into the proper type
convertToWriteback to summary
public String convertToWrite(Object value) throws CsvDataTypeMismatchException

Overrides com.opencsv.bean.AbstractCsvConverter.convertToWrite.

Implements com.opencsv.bean.CsvConverter.convertToWrite.

Converts java.util.Currency instance to a string.

Parameters
value:Object

The java.util.Currency instance

Returns:String

ISO 4217 currency code or null if value was null

Annotations
@Override
Exceptions
CsvDataTypeMismatchException:
If the value is not a java.util.Currency