T
- Type of the bean to be manipulatedpublic class BeanFieldDate<T> extends AbstractBeanField<T>
CsvDate
errorLocale, field, required
Constructor and Description |
---|
BeanFieldDate(Field field,
boolean required,
String formatString,
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 converts the encapsulated date type to a string, respecting
any locales and conversion patterns that have been set through opencsv
annotations.
|
getField, isRequired, setErrorLocale, setField, setFieldValue, setRequired, write
public BeanFieldDate(Field field, boolean required, String formatString, String locale, Locale errorLocale)
field
- A Field
object.required
- True if the field is required to contain a value, false
if it is allowed to be null or a blank string.formatString
- The string to use for formatting the date. See
CsvDate.value()
locale
- 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
convertToWrite
in class AbstractBeanField<T>
value
- The object containing a date of one of the supported typeslocale
or conversion
pattern
has been specified through annotations, these are used when
creating the return value.CsvDataTypeMismatchException
- If an unsupported type as been
improperly annotatedAbstractBeanField.write(java.lang.Object)
Copyright © 2017. All rights reserved.