AssociationLineMapper.java

package com.sintia.ffl.admin.optique.catalogue.batch.reader;

import com.sintia.ffl.admin.optique.catalogue.models.AssociationCSV;
import org.springframework.batch.item.file.mapping.DefaultLineMapper;

/**
 * Convert the raw data from the CSV file to a {@link AssociationCSV} object
 *
 * @author jumazet
 */
public class AssociationLineMapper extends DefaultLineMapper<AssociationCSV> {

	@Override
	public AssociationCSV mapLine(String line, int lineNumber)
			throws Exception {
		AssociationCSV r = super.mapLine(line, lineNumber);
		// this is the reason we must use a custom LineMapper!
		r.setLineNumber(lineNumber);
		return r;

	}
}