Package org.mybatis.spring.batch.builder
Class MyBatisPagingItemReaderBuilder<T>
- java.lang.Object
-
- org.mybatis.spring.batch.builder.MyBatisPagingItemReaderBuilder<T>
-
public class MyBatisPagingItemReaderBuilder<T> extends Object
A builder for theMyBatisPagingItemReader.- Since:
- 2.0.0
- Author:
- Kazuki Shimizu
- See Also:
MyBatisPagingItemReader
-
-
Constructor Summary
Constructors Constructor Description MyBatisPagingItemReaderBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MyBatisPagingItemReader<T>build()Returns a fully builtMyBatisPagingItemReader.MyBatisPagingItemReaderBuilder<T>maxItemCount(int maxItemCount)Configure the max number of items to be read.MyBatisPagingItemReaderBuilder<T>pageSize(int pageSize)The number of records to request per page/query.MyBatisPagingItemReaderBuilder<T>parameterValues(Map<String,Object> parameterValues)Set the parameter values to be used for the query execution.MyBatisPagingItemReaderBuilder<T>parameterValuesSupplier(Supplier<Map<String,Object>> parameterValuesSupplier)Set the parameter supplier to be used to get parameters for the query execution.MyBatisPagingItemReaderBuilder<T>queryId(String queryId)Set the query id identifying the statement in the SqlMap configuration file.MyBatisPagingItemReaderBuilder<T>saveState(boolean saveState)Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.MyBatisPagingItemReaderBuilder<T>sqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)Set theSqlSessionFactoryto be used by writer for database access.
-
-
-
Method Detail
-
sqlSessionFactory
public MyBatisPagingItemReaderBuilder<T> sqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
Set theSqlSessionFactoryto be used by writer for database access.- Parameters:
sqlSessionFactory- theSqlSessionFactoryto be used by writer for database access- Returns:
- this instance for method chaining
- See Also:
MyBatisPagingItemReader.setSqlSessionFactory(SqlSessionFactory)
-
queryId
public MyBatisPagingItemReaderBuilder<T> queryId(String queryId)
Set the query id identifying the statement in the SqlMap configuration file.- Parameters:
queryId- the id for the query- Returns:
- this instance for method chaining
- See Also:
MyBatisPagingItemReader.setQueryId(String)
-
parameterValues
public MyBatisPagingItemReaderBuilder<T> parameterValues(Map<String,Object> parameterValues)
Set the parameter values to be used for the query execution.- Parameters:
parameterValues- the parameter values to be used for the query execution- Returns:
- this instance for method chaining
- See Also:
MyBatisPagingItemReader.setParameterValues(Map)
-
parameterValuesSupplier
public MyBatisPagingItemReaderBuilder<T> parameterValuesSupplier(Supplier<Map<String,Object>> parameterValuesSupplier)
Set the parameter supplier to be used to get parameters for the query execution.- Parameters:
parameterValuesSupplier- the parameter supplier to be used to get parameters for the query execution- Returns:
- this instance for method chaining
- Since:
- 2.1.0
- See Also:
MyBatisPagingItemReader.setParameterValuesSupplier(Supplier)
-
pageSize
public MyBatisPagingItemReaderBuilder<T> pageSize(int pageSize)
The number of records to request per page/query. Defaults to 10. Must be greater than zero.- Parameters:
pageSize- number of items- Returns:
- this instance for method chaining
- See Also:
AbstractPagingItemReader.setPageSize(int)
-
saveState
public MyBatisPagingItemReaderBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.- Parameters:
saveState- defaults to true- Returns:
- The current instance of the builder.
- See Also:
AbstractItemCountingItemStreamItemReader.setSaveState(boolean)
-
maxItemCount
public MyBatisPagingItemReaderBuilder<T> maxItemCount(int maxItemCount)
Configure the max number of items to be read.- Parameters:
maxItemCount- the max items to be read- Returns:
- The current instance of the builder.
- See Also:
AbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
-
build
public MyBatisPagingItemReader<T> build()
Returns a fully builtMyBatisPagingItemReader.- Returns:
- the reader
-
-