use of org.supercsv.cellprocessor.ParseInt in project apex-malhar by apache.
the class AbstractCsvParser method initialise.
// Initialise the properties and processors.
public void initialise(String[] properties, CellProcessor[] processors) {
for (int i = 0; i < getFields().size(); i++) {
FIELD_TYPE type = getFields().get(i).type;
properties[i] = getFields().get(i).name;
if (type == FIELD_TYPE.DOUBLE) {
processors[i] = new Optional(new ParseDouble());
} else if (type == FIELD_TYPE.INTEGER) {
processors[i] = new Optional(new ParseInt());
} else if (type == FIELD_TYPE.FLOAT) {
processors[i] = new Optional(new ParseDouble());
} else if (type == FIELD_TYPE.LONG) {
processors[i] = new Optional(new ParseLong());
} else if (type == FIELD_TYPE.SHORT) {
processors[i] = new Optional(new ParseInt());
} else if (type == FIELD_TYPE.STRING) {
processors[i] = new Optional();
} else if (type == FIELD_TYPE.CHARACTER) {
processors[i] = new Optional(new ParseChar());
} else if (type == FIELD_TYPE.BOOLEAN) {
processors[i] = new Optional(new ParseChar());
} else if (type == FIELD_TYPE.DATE) {
processors[i] = new Optional(new ParseDate("dd/MM/yyyy"));
}
}
}
Aggregations