org.springframework.batch.item.file.mapping.FieldSetMapper Java Examples

The following examples show how to use org.springframework.batch.item.file.mapping.FieldSetMapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringBatchConfiguration.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
@StepScope
public FlatFileItemReader<BookRecord> csvItemReader(@Value("#{jobParameters['file.input']}") String input) {
    FlatFileItemReaderBuilder<BookRecord> builder = new FlatFileItemReaderBuilder<>();
    FieldSetMapper<BookRecord> bookRecordFieldSetMapper = new BookRecordFieldSetMapper();
    LOGGER.info("Configuring reader to input {}", input);
    // @formatter:off
    return builder
      .name("bookRecordItemReader")
      .resource(new FileSystemResource(input))
      .delimited()
      .names(TOKENS)
      .fieldSetMapper(bookRecordFieldSetMapper)
      .build();
    // @formatter:on
}
 
Example #2
Source File: FlatFileItemReaderAutoConfigurationTests.java    From spring-cloud-task with Apache License 2.0 4 votes vote down vote up
@Bean
public FieldSetMapper<Map<Object, Object>> fieldSetMapper() {
	return fieldSet -> fieldSet.getProperties();
}