/** * */ package com.oreilly.springdata.batch; import org.springframework.batch.item.file.mapping.FieldSetMapper; import org.springframework.batch.item.file.transform.FieldSet; import org.springframework.validation.BindException; import com.oreilly.springdata.domain.Product; /** * @author acogoluegnes * */ public class ProductFieldSetMapper implements FieldSetMapper<Product> { /* * (non-Javadoc) * @see org.springframework.batch.item.file.mapping.FieldSetMapper#mapFieldSet(org.springframework.batch.item.file.transform.FieldSet) */ public Product mapFieldSet(FieldSet fieldSet) throws BindException { Product product = new Product(); product.setId(fieldSet.readString("PRODUCT_ID")); product.setName(fieldSet.readString("NAME")); product.setDescription(fieldSet.readString("DESCRIPTION")); product.setPrice(fieldSet.readBigDecimal("PRICE")); return product; } }