Package com.opencsv.bean
Class ConverterCurrency
- java.lang.Object
-
- com.opencsv.bean.AbstractCsvConverter
-
- com.opencsv.bean.ConverterCurrency
-
- All Implemented Interfaces:
CsvConverter
public class ConverterCurrency extends AbstractCsvConverter
This class converts an input ISO 4217 currency code to aCurrencyinstance.- Since:
- 5.3
-
-
Field Summary
-
Fields inherited from class com.opencsv.bean.AbstractCsvConverter
errorLocale, locale, type, writeLocale
-
-
Constructor Summary
Constructors Constructor Description ConverterCurrency(java.util.Locale errorLocale)Initializes the class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectconvertToRead(java.lang.String value)Method for converting from a string to the proper data type of the destination field.java.lang.StringconvertToWrite(java.lang.Object value)ConvertsCurrencyinstance to a string.-
Methods inherited from class com.opencsv.bean.AbstractCsvConverter
setErrorLocale, setLocale, setType, setWriteLocale
-
-
-
-
Method Detail
-
convertToRead
public java.lang.Object convertToRead(java.lang.String value) throws CsvDataTypeMismatchExceptionDescription copied from interface:CsvConverterMethod for converting from a string to the proper data type of the destination field.- Parameters:
value- The ISO 4217 currency code string to be converted- Returns:
Currencyinstance- Throws:
CsvDataTypeMismatchException- If the input string cannot be converted into the proper type
-
convertToWrite
public java.lang.String convertToWrite(java.lang.Object value) throws CsvDataTypeMismatchExceptionConvertsCurrencyinstance to a string.- Specified by:
convertToWritein interfaceCsvConverter- Overrides:
convertToWritein classAbstractCsvConverter- Parameters:
value- TheCurrencyinstance- Returns:
- ISO 4217 currency code or
nullif value wasnull - Throws:
CsvDataTypeMismatchException- If the value is not aCurrency
-
-