Created
April 30, 2019 06:53
-
-
Save Edijun/9f431f8a54fb2377b221463cc2847268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import org.springframework.batch.item.ItemProcessor; | |
| import id.edijun.example.springbatch.model.Product; | |
| public class ProductProcessor implements ItemProcessor<Product, Product> { | |
| private static final Logger log = LoggerFactory.getLogger(ProductProcessor.class); | |
| @Override | |
| public Product process(final Product product) throws Exception { | |
| final String id = product.getId(); | |
| final String name = product.getName(); | |
| final Integer price = product.getPrice(); | |
| final String description = product.getDescription(); | |
| final Product transformedProduct = new Product(id, name, price, description); | |
| log.info("Converting (" + product + ") into (" + transformedProduct + ")"); | |
| return transformedProduct; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment