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 aCurrency
instance.- 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.Object
convertToRead(java.lang.String value)
Method for converting from a string to the proper data type of the destination field.java.lang.String
convertToWrite(java.lang.Object value)
ConvertsCurrency
instance 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 CsvDataTypeMismatchException
Description copied from interface:CsvConverter
Method 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:
Currency
instance- Throws:
CsvDataTypeMismatchException
- If the input string cannot be converted into the proper type
-
convertToWrite
public java.lang.String convertToWrite(java.lang.Object value) throws CsvDataTypeMismatchException
ConvertsCurrency
instance to a string.- Specified by:
convertToWrite
in interfaceCsvConverter
- Overrides:
convertToWrite
in classAbstractCsvConverter
- Parameters:
value
- TheCurrency
instance- Returns:
- ISO 4217 currency code or
null
if value wasnull
- Throws:
CsvDataTypeMismatchException
- If the value is not aCurrency
-
-