Intercepting the line aggregator unfortunately doesn't let me do what I need because I don't have access to the current object at that point - all you get is the field set.
What I'd really like is if FlatFileItemWriter was designed to be subclassed since it would be so much easier to do what I need (without having to do double transformation) ...
Code:
public class MyFlatFileItemWriter extends FlatFileItemWriter {
public void write(Object data) throws Exception {
FieldSet fieldSet = fieldSetCreator.mapItem(data);
String line = lineAggregator.aggregate(fieldSet);
((MyObject) data).setTransformedData(line);
lineBuffer.add(line + LINE_SEPARATOR);
}
}