Package com.oreilly.springdata.batch.item

Source Code of com.oreilly.springdata.batch.item.ProductFieldSetMapper

/**
*
*/
package com.oreilly.springdata.batch.item;

import org.springframework.batch.item.file.mapping.FieldSetMapper;
import org.springframework.batch.item.file.transform.FieldSet;
import org.springframework.data.hadoop.example.domain.Product;
import org.springframework.validation.BindException;



/**
* @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;
  }
 
}
TOP

Related Classes of com.oreilly.springdata.batch.item.ProductFieldSetMapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.