Add beanRowMapper to JdbcCursorItemReaderBuilder
Sets the rowMapper of the JdbcCursorItemReader as a BeanPropertyRowMapper. Resolves BATCH-2710
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
24ab792da7
commit
32692f9583
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import org.springframework.batch.item.database.support.ListPreparedStatementSett
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jdbc.core.ArgumentPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.ArgumentTypePreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.jdbc.core.PreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -310,6 +311,20 @@ public class JdbcCursorItemReaderBuilder<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link BeanPropertyRowMapper} to be used as your
|
||||
* {@link RowMapper}.
|
||||
*
|
||||
* @param mappedClass the class for the row mapper
|
||||
* @return this instance for method chaining
|
||||
* @see BeanPropertyRowMapper
|
||||
*/
|
||||
public JdbcCursorItemReaderBuilder<T> beanRowMapper(Class<T> mappedClass) {
|
||||
this.rowMapper = new BeanPropertyRowMapper<>(mappedClass);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates configuration and builds a new reader instance.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user