public class RepositoryItemReaderBuilder<T>
extends java.lang.Object
RepositoryItemReader
.RepositoryItemReader
Modifier and Type | Class and Description |
---|---|
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.
|
Constructor and Description |
---|
RepositoryItemReaderBuilder() |
Modifier and Type | Method and Description |
---|---|
RepositoryItemReaderBuilder<T> |
arguments(java.util.List<?> arguments)
Arguments to be passed to the data providing method.
|
RepositoryItemReaderBuilder<T> |
arguments(java.lang.Object... arguments)
Arguments to be passed to the data providing method.
|
RepositoryItemReader<T> |
build()
Builds the
RepositoryItemReader . |
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 the
ExecutionContext . |
RepositoryItemReaderBuilder<T> |
pageSize(int pageSize)
Establish the pageSize for the generated RepositoryItemReader.
|
RepositoryItemReaderBuilder<T> |
repository(org.springframework.data.repository.PagingAndSortingRepository<?,?> repository)
The
PagingAndSortingRepository
implementation used to read input from. |
RepositoryItemReaderBuilder<T> |
repository(RepositoryItemReaderBuilder.RepositoryMethodReference<?> repositoryMethodReference)
Specifies a repository and the type-safe method to call for the reader.
|
RepositoryItemReaderBuilder<T> |
saveState(boolean saveState)
Configure if the state of the
ItemStreamSupport
should be persisted within the ExecutionContext
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.
|
public RepositoryItemReaderBuilder<T> saveState(boolean saveState)
ItemStreamSupport
should be persisted within the ExecutionContext
for restart purposes.saveState
- defaults to truepublic RepositoryItemReaderBuilder<T> name(java.lang.String name)
ExecutionContext
. Required if
saveState(boolean)
is set to true.name
- name of the reader instanceItemStreamSupport.setName(String)
public RepositoryItemReaderBuilder<T> maxItemCount(int maxItemCount)
maxItemCount
- the max items to be readAbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
public RepositoryItemReaderBuilder<T> currentItemCount(int currentItemCount)
currentItemCount
- current indexAbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
public RepositoryItemReaderBuilder<T> arguments(java.util.List<?> arguments)
arguments
- list of method arguments to be passed to the repository.RepositoryItemReader.setArguments(List)
public RepositoryItemReaderBuilder<T> arguments(java.lang.Object... arguments)
arguments
- the method arguments to be passed to the repository.RepositoryItemReader.setArguments(List)
public RepositoryItemReaderBuilder<T> sorts(java.util.Map<java.lang.String,org.springframework.data.domain.Sort.Direction> sorts)
sorts
- the fields to sort by and the directions.RepositoryItemReader.setSort(Map)
public RepositoryItemReaderBuilder<T> pageSize(int pageSize)
pageSize
- The number of items to retrieve per page.RepositoryItemReader.setPageSize(int)
public RepositoryItemReaderBuilder<T> repository(org.springframework.data.repository.PagingAndSortingRepository<?,?> repository)
PagingAndSortingRepository
implementation used to read input from.repository
- underlying repository for input to be read from.RepositoryItemReader.setRepository(PagingAndSortingRepository)
public RepositoryItemReaderBuilder<T> methodName(java.lang.String methodName)
Pageable
as the last argument.methodName
- name of the method to invoke.RepositoryItemReader.setMethodName(String)
public RepositoryItemReaderBuilder<T> repository(RepositoryItemReaderBuilder.RepositoryMethodReference<?> repositoryMethodReference)
Pageable
as the last
argument. This method can be used in place of repository(PagingAndSortingRepository)
,
methodName(String)
, and arguments(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.RepositoryItemReader.setMethodName(String)
,
RepositoryItemReader.setRepository(PagingAndSortingRepository)
public RepositoryItemReader<T> build()
RepositoryItemReader
.RepositoryItemReader