Package com.opencsv.bean
Class ConverterCurrency
java.lang.Object
com.opencsv.bean.AbstractCsvConverter
com.opencsv.bean.ConverterCurrency
- All Implemented Interfaces:
CsvConverter
This class converts an input ISO 4217 currency code to a
Currency
instance.- Since:
- 5.3
-
Field Summary
Fields inherited from class com.opencsv.bean.AbstractCsvConverter
errorLocale, locale, type, writeLocale
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToRead
(String value) Method for converting from a string to the proper data type of the destination field.convertToWrite
(Object value) ConvertsCurrency
instance to a string.Methods inherited from class com.opencsv.bean.AbstractCsvConverter
setErrorLocale, setLocale, setType, setWriteLocale
-
Constructor Details
-
ConverterCurrency
Initializes the class.- Parameters:
errorLocale
- The locale to use for error messages
-
-
Method Details
-
convertToRead
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
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
-