View Javadoc

1   package org.springframework.batch.sample.domain.order.internal.extractor;
2   
3   import java.text.SimpleDateFormat;
4   
5   import org.springframework.batch.item.file.transform.FieldExtractor;
6   import org.springframework.batch.sample.domain.order.Order;
7   
8   /**
9    * @author Dan Garrette
10   * @since 2.0.1
11   */
12  public class HeaderFieldExtractor implements FieldExtractor<Order> {
13  
14  	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
15  
16  	public Object[] extract(Order order) {
17  		return new Object[] { "BEGIN_ORDER:", order.getOrderId(), dateFormat.format(order.getOrderDate()) };
18  	}
19  
20  }