T
- The type of the beanpublic class BeanFieldPrimitiveTypes<T> extends AbstractBeanField<T>
errorLocale, field, required
Constructor and Description |
---|
BeanFieldPrimitiveTypes(Field field,
boolean required,
String locale,
Locale errorLocale) |
Modifier and Type | Method and Description |
---|---|
protected Object |
convert(String value)
Method for converting from a string to the proper datatype of the
destination field.
|
protected 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.
|
getField, isRequired, setErrorLocale, setField, setFieldValue, setRequired, write
public BeanFieldPrimitiveTypes(Field field, boolean required, String locale, Locale errorLocale)
field
- A Field
objectrequired
- True if the field is required to contain a value, false
if it is allowed to be null or a blank stringlocale
- If not null or empty, specifies the locale used for
converting locale-specific data typeserrorLocale
- The locale to use for error messages.protected Object convert(String value) throws CsvDataTypeMismatchException
AbstractBeanField
convert
in class AbstractBeanField<T>
value
- 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 typeprotected String convertToWrite(Object value) throws CsvDataTypeMismatchException
String
, BigDecimal
, and
BigInteger
.convertToWrite
in class AbstractBeanField<T>
value
- The contents of the field currently being processed from the
bean to be written. Can be null.value
is nullCsvDataTypeMismatchException
- If there is an error converting
value to a stringAbstractBeanField.write(java.lang.Object)
Copyright © 2017. All rights reserved.