use of org.supercsv.cellprocessor.Optional in project apex-malhar by apache.
the class CsvFormatter method getProcessor.
/**
* Returns array of cellprocessors, one for each field
*/
private CellProcessor[] getProcessor(List<Field> fields) {
CellProcessor[] processor = new CellProcessor[fields.size()];
int fieldCount = 0;
for (Field field : fields) {
if (field.getType() == FieldType.DATE) {
String format = field.getConstraints().get(DelimitedSchema.DATE_FORMAT) == null ? null : (String) field.getConstraints().get(DelimitedSchema.DATE_FORMAT);
processor[fieldCount++] = new Optional(new FmtDate(format == null ? "dd/MM/yyyy" : format));
} else {
processor[fieldCount++] = new Optional();
}
}
return processor;
}
Aggregations