类 RepositoryItemReaderBuilder<T>
- java.lang.Object
- org.springframework.batch.item.data.builder.RepositoryItemReaderBuilder<T>
public class RepositoryItemReaderBuilder<T> extends java.lang.Object
A builder implementation for theRepositoryItemReader
.- 从以下版本开始:
- 4.0
- 作者:
- Glenn Renfro, Mahmoud Ben Hassine
- 另请参阅:
RepositoryItemReader
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
RepositoryItemReaderBuilder.RepositoryMethodReference<T>
Establishes a proxy that will capture a the Repository and the associated methodName that will be used by the reader.
构造器概要
构造器 构造器 说明 RepositoryItemReaderBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 RepositoryItemReaderBuilder<T>
arguments(java.util.List<?> arguments)
Arguments to be passed to the data providing method.RepositoryItemReader<T>
build()
Builds theRepositoryItemReader
.RepositoryItemReaderBuilder<T>
currentItemCount(int currentItemCount)
Index for the current item.RepositoryItemReaderBuilder<T>
maxItemCount(int maxItemCount)
Configure the max number of items to be read.RepositoryItemReaderBuilder<T>
methodName(java.lang.String methodName)
Specifies what method on the repository to call.RepositoryItemReaderBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.RepositoryItemReaderBuilder<T>
pageSize(int pageSize)
Establish the pageSize for the generated RepositoryItemReader.RepositoryItemReaderBuilder<T>
repository(RepositoryItemReaderBuilder.RepositoryMethodReference repositoryMethodReference)
Specifies a repository and the type-safe method to call for the reader.RepositoryItemReaderBuilder<T>
repository(org.springframework.data.repository.PagingAndSortingRepository<?,?> repository)
ThePagingAndSortingRepository
implementation used to read input from.RepositoryItemReaderBuilder<T>
saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.RepositoryItemReaderBuilder<T>
sorts(java.util.Map<java.lang.String,org.springframework.data.domain.Sort.Direction> sorts)
Provides ordering of the results so that order is maintained between paged queries.
构造器详细资料
RepositoryItemReaderBuilder
public RepositoryItemReaderBuilder()
方法详细资料
saveState
public RepositoryItemReaderBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- 参数:
saveState
- defaults to true- 返回:
- The current instance of the builder.
name
public RepositoryItemReaderBuilder<T> name(java.lang.String name)
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- 参数:
name
- name of the reader instance- 返回:
- The current instance of the builder.
- 另请参阅:
ItemStreamSupport.setName(String)
maxItemCount
public RepositoryItemReaderBuilder<T> maxItemCount(int maxItemCount)
Configure the max number of items to be read.- 参数:
maxItemCount
- the max items to be read- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
currentItemCount
public RepositoryItemReaderBuilder<T> currentItemCount(int currentItemCount)
Index for the current item. Used on restarts to indicate where to start from.- 参数:
currentItemCount
- current index- 返回:
- this instance for method chaining
- 另请参阅:
AbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
arguments
public RepositoryItemReaderBuilder<T> arguments(java.util.List<?> arguments)
Arguments to be passed to the data providing method.- 参数:
arguments
- list of method arguments to be passed to the repository.- 返回:
- The current instance of the builder.
- 另请参阅:
RepositoryItemReader.setArguments(List)
sorts
public RepositoryItemReaderBuilder<T> sorts(java.util.Map<java.lang.String,org.springframework.data.domain.Sort.Direction> sorts)
Provides ordering of the results so that order is maintained between paged queries.- 参数:
sorts
- the fields to sort by and the directions.- 返回:
- The current instance of the builder.
- 另请参阅:
RepositoryItemReader.setSort(Map)
pageSize
public RepositoryItemReaderBuilder<T> pageSize(int pageSize)
Establish the pageSize for the generated RepositoryItemReader.- 参数:
pageSize
- The number of items to retrieve per page.- 返回:
- The current instance of the builder.
- 另请参阅:
RepositoryItemReader.setPageSize(int)
repository
public RepositoryItemReaderBuilder<T> repository(org.springframework.data.repository.PagingAndSortingRepository<?,?> repository)
ThePagingAndSortingRepository
implementation used to read input from.- 参数:
repository
- underlying repository for input to be read from.- 返回:
- The current instance of the builder.
- 另请参阅:
RepositoryItemReader.setRepository(PagingAndSortingRepository)
methodName
public RepositoryItemReaderBuilder<T> methodName(java.lang.String methodName)
Specifies what method on the repository to call. This method must takePageable
as the last argument.- 参数:
methodName
- name of the method to invoke.- 返回:
- The current instance of the builder.
- 另请参阅:
RepositoryItemReader.setMethodName(String)
repository
public RepositoryItemReaderBuilder<T> repository(RepositoryItemReaderBuilder.RepositoryMethodReference repositoryMethodReference)
Specifies a repository and the type-safe method to call for the reader. The method configured via this mechanism must takePageable
as the last argument. This method can be used in place ofrepository(PagingAndSortingRepository)
,methodName(String)
, andarguments(List)
. Note: The repository that is used by the repositoryMethodReference must be non-final.- 参数:
repositoryMethodReference
- of the used to get a repository and type-safe method for use by the reader.- 返回:
- The current instance of the builder.
- 另请参阅:
RepositoryItemReader.setMethodName(String)
,RepositoryItemReader.setRepository(PagingAndSortingRepository)
build
public RepositoryItemReader<T> build()
Builds theRepositoryItemReader
.- 返回:
- a
RepositoryItemReader