Class PageableItemReaderBuilder<T>
java.lang.Object
org.springframework.batch.infrastructure.item.data.builder.PageableItemReaderBuilder<T>
- Type Parameters:
T- type of items to read
A builder for
PageableItemReader.- Since:
- 6.1
- Author:
- Stefano Cordio
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds thePageableItemReader.currentItemCount(int currentItemCount) Index for the current item.maxItemCount(int maxItemCount) Configure the max number of items to be read.The name used to calculate the key within theExecutionContext.pageSize(int pageSize) The number of items to read with each page.query(Function<org.springframework.data.domain.Pageable, ? extends org.springframework.data.domain.Slice<? extends T>> query) A function that accepts aPageableand returns aSliceof items.saveState(boolean saveState) Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.sort(org.springframework.data.domain.Sort sort) Configures the sort parameters for the query.
-
Constructor Details
-
PageableItemReaderBuilder
public PageableItemReaderBuilder()
-
-
Method Details
-
query
public PageableItemReaderBuilder<T> query(Function<org.springframework.data.domain.Pageable, ? extends org.springframework.data.domain.Slice<? extends T>> query) A function that accepts aPageableand returns aSliceof items.- Parameters:
query- the query function to apply for each page- Returns:
- this instance for method chaining
- See Also:
-
pageSize
The number of items to read with each page.- Parameters:
pageSize- the number of items per page. Defaults to 10 and must be greater than 0.- Returns:
- this instance for method chaining
- See Also:
-
sort
Configures the sort parameters for the query. Optional, defaults toSort.unsorted().- Parameters:
sort- the sort to apply to the query- Returns:
- this instance for method chaining
- See Also:
-
saveState
Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.- Parameters:
saveState- defaults to true- Returns:
- this instance for method chaining
-
name
The name used to calculate the key within theExecutionContext. Defaults to the bean name, or to the short class name if this instance is not a bean. Set it explicitly to disambiguate several non-bean instances of the same type in a step.- Parameters:
name- name of the reader instance- Returns:
- this instance for method chaining
- See Also:
-
maxItemCount
Configure the max number of items to be read.- Parameters:
maxItemCount- the max items to be read- Returns:
- this instance for method chaining
- See Also:
-
currentItemCount
Index for the current item. Used on restarts to indicate where to start from.- Parameters:
currentItemCount- current index- Returns:
- this instance for method chaining
- See Also:
-
build
-