Announcement Announcement Module
Collapse
No announcement yet.
Calendar format in ItemWriter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calendar format in ItemWriter

    I'm using a FlatFileItemWriter to write data to a CSV file. Is there any way to register a CustomEditorConfigurer with something in the writer configuration (the LineAggregator or FieldExtractor?) so that I have control over the output format of Calendar/Date properties of the objects being written?

    I'm looking for the ItemWriter analog to the way you register PropertyEditors with a FieldSetMapper during a read.

    Thanks.

  • #2
    To my knowledge there is not a way to register custom formatters for a given property while using the FlatFileItemWriter and the LineAggregators provided by the framework. This leaves you two options:
    1. Implement your own FieldExtractor - This would allow you to format the extracted fields in to the desired String for output by the DelimitedLineAggregator.
    2. Use the FormatterLineAggregator - Since the FormatterLineAggregator uses String.format to generate an output line you can use it to generate your CSV with whatever formatting you'd want. Using this option you would use the format string to determine what each value between the commas would be.
    IMHO, I'd go with the FormatterLineAggregator so I didn't have to write any more code.

    Comment

    Working...
    X