public class MongoItemReaderBuilder<T>
extends java.lang.Object
MongoItemReader
MongoItemReader
Modifier and Type | Field and Description |
---|---|
protected int |
pageSize |
Constructor and Description |
---|
MongoItemReaderBuilder() |
Modifier and Type | Method and Description |
---|---|
MongoItemReader<T> |
build()
Validates and builds a
MongoItemReader . |
MongoItemReaderBuilder<T> |
collection(java.lang.String collection)
Establish an optional collection that can be queried.
|
MongoItemReaderBuilder<T> |
currentItemCount(int currentItemCount)
Index for the current item.
|
MongoItemReaderBuilder<T> |
fields(java.lang.String fields)
JSON defining the fields to be returned from the matching documents by MongoDB.
|
MongoItemReaderBuilder<T> |
hint(java.lang.String hint)
JSON String telling MongoDB what index to use.
|
MongoItemReaderBuilder<T> |
jsonQuery(java.lang.String query)
A JSON formatted MongoDB jsonQuery.
|
MongoItemReaderBuilder<T> |
maxItemCount(int maxItemCount)
Configure the max number of items to be read.
|
MongoItemReaderBuilder<T> |
name(java.lang.String name)
The name used to calculate the key within the
ExecutionContext . |
MongoItemReaderBuilder<T> |
pageSize(int pageSize)
The number of items to be read with each page.
|
MongoItemReaderBuilder<T> |
parameterValues(java.util.List<java.lang.Object> parameterValues)
List of values to be substituted in for each of the parameters in the
query. |
MongoItemReaderBuilder<T> |
query(org.springframework.data.mongodb.core.query.Query query)
Provide a Spring Data Mongo
Query . |
MongoItemReaderBuilder<T> |
saveState(boolean saveState)
Configure if the state of the
ItemStreamSupport
should be persisted within the ExecutionContext
for restart purposes. |
MongoItemReaderBuilder<T> |
sorts(java.util.Map<java.lang.String,org.springframework.data.domain.Sort.Direction> sorts)
Map of property
names/Sort.Direction values to sort the
input by. |
MongoItemReaderBuilder<T> |
targetType(java.lang.Class<? extends T> targetType)
The type of object to be returned for each
AbstractItemCountingItemStreamItemReader.read() call. |
MongoItemReaderBuilder<T> |
template(org.springframework.data.mongodb.core.MongoOperations template)
Used to perform operations against the MongoDB instance.
|
public MongoItemReaderBuilder<T> saveState(boolean saveState)
ItemStreamSupport
should be persisted within the ExecutionContext
for restart purposes.saveState
- defaults to truepublic MongoItemReaderBuilder<T> name(java.lang.String name)
ExecutionContext
. Required if
saveState(boolean)
is set to true.name
- name of the reader instanceItemStreamSupport.setName(String)
public MongoItemReaderBuilder<T> maxItemCount(int maxItemCount)
maxItemCount
- the max items to be readAbstractItemCountingItemStreamItemReader.setMaxItemCount(int)
public MongoItemReaderBuilder<T> currentItemCount(int currentItemCount)
currentItemCount
- current indexAbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
public MongoItemReaderBuilder<T> template(org.springframework.data.mongodb.core.MongoOperations template)
template
- the MongoOperations instance to useMongoOperations
,
MongoItemReader.setTemplate(MongoOperations)
public MongoItemReaderBuilder<T> jsonQuery(java.lang.String query)
query
- JSON formatted Mongo jsonQueryMongoItemReader.setQuery(String)
public MongoItemReaderBuilder<T> targetType(java.lang.Class<? extends T> targetType)
AbstractItemCountingItemStreamItemReader.read()
call.targetType
- the type of object to returnMongoItemReader.setTargetType(Class)
public MongoItemReaderBuilder<T> parameterValues(java.util.List<java.lang.Object> parameterValues)
List
of values to be substituted in for each of the parameters in the
query.parameterValues
- valuesMongoItemReader.setParameterValues(List)
public MongoItemReaderBuilder<T> fields(java.lang.String fields)
fields
- JSON string that identifies the fields to sort by.MongoItemReader.setFields(String)
public MongoItemReaderBuilder<T> sorts(java.util.Map<java.lang.String,org.springframework.data.domain.Sort.Direction> sorts)
Map
of property
names/Sort.Direction
values to sort the
input by.sorts
- map of properties and direction to sort each.MongoItemReader.setSort(Map)
public MongoItemReaderBuilder<T> collection(java.lang.String collection)
collection
- Mongo collection to be queried.MongoItemReader.setCollection(String)
public MongoItemReaderBuilder<T> hint(java.lang.String hint)
hint
- string indicating what index to use.MongoItemReader.setHint(String)
public MongoItemReaderBuilder<T> pageSize(int pageSize)
pageSize
- the number of itemsAbstractPaginatedDataItemReader.setPageSize(int)
public MongoItemReaderBuilder<T> query(org.springframework.data.mongodb.core.query.Query query)
Query
. This will take precidence over a JSON
configured query.query
- Query to executeMongoItemReader.setQuery(Query)
public MongoItemReader<T> build()
MongoItemReader
.MongoItemReader