class MultiRecordTypeJobConfiguration {

	@Bean
	@StepScope
	public FlatFileItemReader itemReader(PatternMatchingCompositeLineMapper lineMapper,
			@Value("#{jobParameters[inputFile]}") Resource resource) {
		return new FlatFileItemReaderBuilder().name("itemReader").resource(resource).lineMapper(lineMapper).build();
	}

	@Bean
	public PatternMatchingCompositeLineMapper prefixMatchingLineMapper() {
		PatternMatchingCompositeLineMapper mapper = new PatternMatchingCompositeLineMapper();
		mapper.setTokenizers(Map.of("TRAD*", tradeLineTokenizer(), "CUST*", customerLineTokenizer()));
		mapper.setFieldSetMappers(
				Map.of("TRAD*", new TradeFieldSetMapper(), "CUST*", new CustomerCreditFieldSetMapper()));
		return mapper;
	}

	@Bean
	public FixedLengthTokenizer tradeLineTokenizer() {
		FixedLengthTokenizer tokenizer = new FixedLengthTokenizer();
		tokenizer.setNames("isin", "quantity", "price", "customer");
		tokenizer.setColumns(new Range(5, 16), new Range(17, 19), new Range(20, 25), new Range(26, 34));
		return tokenizer;
	}

	@Bean
	public FixedLengthTokenizer customerLineTokenizer() {
		FixedLengthTokenizer tokenizer = new FixedLengthTokenizer();
		tokenizer.setNames("id", "name", "credit");
		tokenizer.setColumns(new Range(5, 9), new Range(10, 18), new Range(19, 26));
		return tokenizer;
	}

	@Bean
	@StepScope
	public FlatFileItemWriter itemWriter(DelegatingTradeLineAggregator delegatingTradeLineAggregator,
			@Value("#{jobParameters[outputFile]}") WritableResource resource) {
		return new FlatFileItemWriterBuilder().name("iemWriter")
			.resource(resource)
			.lineAggregator(delegatingTradeLineAggregator)
			.build();
	}

	@Bean
	public DelegatingTradeLineAggregator delegatingTradeLineAggregator(
			FormatterLineAggregator<Trade> tradeLineAggregator,
			FormatterLineAggregator<CustomerCredit> customerLineAggregator) {
		DelegatingTradeLineAggregator lineAggregator = new DelegatingTradeLineAggregator();
		lineAggregator.setTradeLineAggregator(tradeLineAggregator);
		lineAggregator.setCustomerLineAggregator(customerLineAggregator);
		return lineAggregator;
	}

	@Bean
	public FormatterLineAggregator<Trade> tradeLineAggregator() {<FILL_FUNCTION_BODY>}

	@Bean
	public FormatterLineAggregator<CustomerCredit> customerLineAggregator() {
		FormatterLineAggregator<CustomerCredit> formatterLineAggregator = new FormatterLineAggregator<>();
		BeanWrapperFieldExtractor<CustomerCredit> fieldExtractor = new BeanWrapperFieldExtractor<>();
		fieldExtractor.setNames(new String[] { "id", "name", "credit" });
		formatterLineAggregator.setFieldExtractor(fieldExtractor);
		formatterLineAggregator.setFormat("CUST%05d%-9s%08.0f");
		return formatterLineAggregator;
	}

	@Bean
	public Job job(JobRepository jobRepository, JdbcTransactionManager transactionManager,
			FlatFileItemReader itemReader, FlatFileItemWriter itemWriter) {
		return new JobBuilder("ioSampleJob", jobRepository)
			.start(new StepBuilder("step1", jobRepository).chunk(2, transactionManager)
				.reader(itemReader)
				.writer(itemWriter)
				.build())
			.build();
	}

}

		FormatterLineAggregator<Trade> formatterLineAggregator = new FormatterLineAggregator<>();
		BeanWrapperFieldExtractor<Trade> fieldExtractor = new BeanWrapperFieldExtractor<>();
		fieldExtractor.setNames(new String[] { "isin", "quantity", "price", "customer" });
		formatterLineAggregator.setFieldExtractor(fieldExtractor);
		formatterLineAggregator.setFormat("TRAD%-12s%-3d%6s%-9s");
		return formatterLineAggregator;
	
<no_super_class>