public class ConverterEnum extends AbstractCsvConverter
errorLocale, locale, type, writeLocale| Constructor and Description |
|---|
ConverterEnum(Class<?> type,
String locale,
String writeLocale,
Locale errorLocale) |
| Modifier and Type | Method and Description |
|---|---|
Object |
convertToRead(String value)
Method for converting from a string to the proper data type of the
destination field.
|
String |
convertToWrite(Object value)
This implementation simply calls
toString() on value. |
setErrorLocale, setLocale, setType, setWriteLocalepublic ConverterEnum(Class<?> type, String locale, String writeLocale, Locale errorLocale)
type - The class of the type of the data being processedlocale - If not null or empty, specifies the locale used for
converting locale-specific data typeswriteLocale - If not null or empty, specifies the locale used for
converting locale-specific data types for writingerrorLocale - The locale to use for error messages.public Object convertToRead(String value) throws CsvDataTypeMismatchException
CsvConvertervalue - The string from the selected field of the CSV file. If the
field is marked as required in the annotation, this value is guaranteed
not to be null, empty or blank according to
StringUtils.isBlank(java.lang.CharSequence)Object representing the input data converted
into the proper typeCsvDataTypeMismatchException - If the input string cannot be converted into
the proper typepublic String convertToWrite(Object value)
AbstractCsvConvertertoString() on value.
For complex types, overriding the toString() method in the type
of the field in question would be an alternative to writing a conversion
routine in a class derived from this one.convertToWrite in interface CsvConverterconvertToWrite in class AbstractCsvConvertervalue - The contents of the field currently being processed from the
bean to be written. Can be null if the field is not marked as
required.value is nullCopyright © 2005–2025. All rights reserved.