T
- Type of the bean being populatedpublic interface BeanField<T>
Field
class to include
functionality that opencsv requires.
This includes a required flag and a write(java.lang.Object)
method
for writing beans back out to a CSV file. The required flag determines if the
field has to be non-empty.Modifier and Type | Method and Description |
---|---|
Field |
getField()
Gets the field to be processed.
|
boolean |
isRequired()
Answers the query, whether this field is required or not.
|
void |
setField(Field field)
Sets the field to be processed.
|
<T> void |
setFieldValue(T bean,
String value)
Populates the selected field of the bean.
|
void |
setRequired(boolean required)
Determines whether or not a field is required.
|
String |
write(T bean)
This method takes the current value of the field in question in the bean
passed in and converts it to a string.
|
void setField(Field field)
field
- Which field is being populatedboolean isRequired()
void setRequired(boolean required)
required
- Whether or not the field is required<T> void setFieldValue(T bean, String value) throws CsvDataTypeMismatchException, CsvRequiredFieldEmptyException, CsvConstraintViolationException
T
- Type of the bean.bean
- Object containing the field to be set.value
- String containing the value to set the field to.CsvDataTypeMismatchException
- When the result of data conversion returns
an object that cannot be assigned to the selected fieldCsvRequiredFieldEmptyException
- When a field is mandatory, but there is no
input datum in the CSV fileCsvConstraintViolationException
- When the internal structure of
data would be violated by the data in the CSV fileString write(T bean) throws CsvDataTypeMismatchException, CsvRequiredFieldEmptyException
bean
- The bean holding the field to be writtenCsvDataTypeMismatchException
- If expected to convert an
unsupported data typeCsvRequiredFieldEmptyException
- If the field is marked as required,
but currently contains nullCopyright © 2017. All rights reserved.