public class ConverterPrimitiveTypes extends AbstractCsvConverter
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.beanutils.ConvertUtilsBean |
readConverter
The formatter for all inputs to wrapped and unwrapped primitive
types when a specific locale is not required.
|
protected org.apache.commons.beanutils.locale.LocaleConvertUtilsBean |
readLocaleConverter
The formatter for all inputs to wrapped and unwrapped primitive
types when a specific locale is required.
|
protected org.apache.commons.beanutils.ConvertUtilsBean |
writeConverter
The formatter for all inputs from wrapped and unwrapped primitive
types when a specific locale is not required.
|
protected org.apache.commons.beanutils.locale.LocaleConvertUtilsBean |
writeLocaleConverter
The formatter for all inputs from wrapped and unwrapped primitive
types when a specific locale is required.
|
errorLocale, locale, type, writeLocale| Constructor and Description |
|---|
ConverterPrimitiveTypes(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 method takes the current value of the field in question in the bean
passed in and converts it to a string.
|
setErrorLocale, setLocale, setType, setWriteLocaleprotected final org.apache.commons.beanutils.ConvertUtilsBean readConverter
Either this or readLocaleConverter should be used, and the
other should always be null.
It is absolutely critical that access to this member variable is always synchronized!
protected final org.apache.commons.beanutils.locale.LocaleConvertUtilsBean readLocaleConverter
Either this or readConverter should be used, and the other
should always be null.
It is absolutely critical that access to this member variable is always synchronized!
protected final org.apache.commons.beanutils.ConvertUtilsBean writeConverter
Either this or writeLocaleConverter should be used, and the
other should always be null.
It is absolutely critical that access to this member variable is always synchronized!
protected final org.apache.commons.beanutils.locale.LocaleConvertUtilsBean writeLocaleConverter
Either this or writeConverter should be used, and the other
should always be null.
It is absolutely critical that access to this member variable is always synchronized!
public ConverterPrimitiveTypes(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) throws CsvDataTypeMismatchException
String, BigDecimal, and
BigInteger.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 nullCsvDataTypeMismatchException - If there is an error converting
value to a stringCopyright © 2005–2025. All rights reserved.