Announcement Announcement Module
Collapse
No announcement yet.
BeanWrapperFieldExtractor Formatting Fields Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanWrapperFieldExtractor Formatting Fields

    Hi,

    I have the following FlatFileItemWriter:

    Code:
    	<bean id="accountFlatFileItemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter">
    		<property name="resource" value="c:\test.csv" />
    		<property name="lineAggregator">
    			<bean
    				class="org.springframework.batch.item.file.transform.DelimitedLineAggregator">
    				<property name="delimiter" value="," />
    				<property name="fieldExtractor">
    					<bean
    						class="org.springframework.batch.item.file.transform.BeanWrapperFieldExtractor">
    						<property name="names" value="id,lastName,firstName,dateModified" />
    					</bean>
    				</property>
    			</bean>
    		</property>
    	</bean>
    This will create an csv with the following columns:
    id,lastName,firstName,dateModified

    I am new to Spring Batch project and wanted to know how would I go abouts formatting the "dateModified" values? i.e.: dd/MM/yyyy...?

    Appreciate any feedback.

  • #2
    Use a FormatterLineAggregator is one way, or write your own aggregator.

    Comment


    • #3
      Yeah but what I what to know how... do you have a sample code or links?

      Comment


      • #4
        There is a sample that uses the FormatterLineAggregator (https://fisheye.springsource.org/bro...ngth.xml#r2746). For more on formats see the JDK (http://java.sun.com/j2se/1.5.0/docs/...Formatter.html).

        Comment


        • #5
          Thanks Dave.

          Comment

          Working...
          X