Class Neo4jItemReaderBuilder<T>
- java.lang.Object
- org.springframework.batch.item.data.builder.Neo4jItemReaderBuilder<T>
public class Neo4jItemReaderBuilder<T> extends java.lang.Object
A builder for theNeo4jItemReader
.- Since:
- 4.0
- Author:
- Glenn Renfro
- See Also:
Neo4jItemReader
Constructor Summary
Constructors Constructor Description Neo4jItemReaderBuilder()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Neo4jItemReader<T>
build()
Returns a fully constructedNeo4jItemReader
.Neo4jItemReaderBuilder<T>
currentItemCount(int currentItemCount)
Index for the current item.Neo4jItemReaderBuilder<T>
matchStatement(java.lang.String matchStatement)
An optional match fragment of the cypher query.Neo4jItemReaderBuilder<T>
maxItemCount(int maxItemCount)
Configure the max number of items to be read.Neo4jItemReaderBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.Neo4jItemReaderBuilder<T>
orderByStatement(java.lang.String orderByStatement)
A list of properties to order the results by.Neo4jItemReaderBuilder<T>
pageSize(int pageSize)
The number of items to be read with each page.Neo4jItemReaderBuilder<T>
parameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Optional parameters to be used in the cypher query.Neo4jItemReaderBuilder<T>
returnStatement(java.lang.String returnStatement)
The return statement of the cypher query.Neo4jItemReaderBuilder<T>
saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.Neo4jItemReaderBuilder<T>
sessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Establish the session factory for the reader.Neo4jItemReaderBuilder<T>
startStatement(java.lang.String startStatement)
The start segment of the cypher query.Neo4jItemReaderBuilder<T>
targetType(java.lang.Class<T> targetType)
The object type to be returned from each call toAbstractItemCountingItemStreamItemReader.read()
Neo4jItemReaderBuilder<T>
whereStatement(java.lang.String whereStatement)
An optional where fragment of the cypher query.
Method Detail
saveState
public Neo4jItemReaderBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- Parameters:
saveState
- defaults to true- Returns:
- The current instance of the builder.
name
public Neo4jItemReaderBuilder<T> name(java.lang.String name)
The name used to calculate the key within theExecutionContext
. Required ifsaveState(boolean)
is set to true.- Parameters:
name
- name of the reader instance- Returns:
- The current instance of the builder.
- See Also:
ItemStreamSupport.setName(String)
maxItemCount
public Neo4jItemReaderBuilder<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)
currentItemCount
public Neo4jItemReaderBuilder<T> currentItemCount(int 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:
AbstractItemCountingItemStreamItemReader.setCurrentItemCount(int)
sessionFactory
public Neo4jItemReaderBuilder<T> sessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Establish the session factory for the reader.- Parameters:
sessionFactory
- the factory to use for the reader.- Returns:
- this instance for method chaining
- See Also:
AbstractNeo4jItemReader.setSessionFactory(SessionFactory)
pageSize
public Neo4jItemReaderBuilder<T> pageSize(int pageSize)
The number of items to be read with each page.- Parameters:
pageSize
- the number of items- Returns:
- this instance for method chaining
- See Also:
AbstractPaginatedDataItemReader.setPageSize(int)
parameterValues
public Neo4jItemReaderBuilder<T> parameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Optional parameters to be used in the cypher query.- Parameters:
parameterValues
- the parameter values to be used in the cypher query- Returns:
- this instance for method chaining
- See Also:
AbstractNeo4jItemReader.setParameterValues(Map)
startStatement
public Neo4jItemReaderBuilder<T> startStatement(java.lang.String startStatement)
The start segment of the cypher query. START is prepended to the statement provided and should not be included.- Parameters:
startStatement
- the start fragment of the cypher query.- Returns:
- this instance for method chaining
- See Also:
AbstractNeo4jItemReader.setStartStatement(String)
returnStatement
public Neo4jItemReaderBuilder<T> returnStatement(java.lang.String returnStatement)
The return statement of the cypher query. RETURN is prepended to the statement provided and should not be included- Parameters:
returnStatement
- the return fragment of the cypher query.- Returns:
- this instance for method chaining
- See Also:
AbstractNeo4jItemReader.setReturnStatement(String)
matchStatement
public Neo4jItemReaderBuilder<T> matchStatement(java.lang.String matchStatement)
An optional match fragment of the cypher query. MATCH is prepended to the statement provided and should not be included.- Parameters:
matchStatement
- the match fragment of the cypher query- Returns:
- this instance for method chaining
- See Also:
AbstractNeo4jItemReader.setMatchStatement(String)
whereStatement
public Neo4jItemReaderBuilder<T> whereStatement(java.lang.String whereStatement)
An optional where fragment of the cypher query. WHERE is prepended to the statement provided and should not be included.- Parameters:
whereStatement
- where fragment of the cypher query- Returns:
- this instance for method chaining
- See Also:
AbstractNeo4jItemReader.setWhereStatement(String)
orderByStatement
public Neo4jItemReaderBuilder<T> orderByStatement(java.lang.String orderByStatement)
A list of properties to order the results by. This is required so that subsequent page requests pull back the segment of results correctly. ORDER BY is prepended to the statement provided and should not be included.- Parameters:
orderByStatement
- order by fragment of the cypher query.- Returns:
- this instance for method chaining
- See Also:
AbstractNeo4jItemReader.setOrderByStatement(String)
targetType
public Neo4jItemReaderBuilder<T> targetType(java.lang.Class<T> targetType)
The object type to be returned from each call toAbstractItemCountingItemStreamItemReader.read()
- Parameters:
targetType
- the type of object to return.- Returns:
- this instance for method chaining
- See Also:
AbstractNeo4jItemReader.setTargetType(Class)
build
public Neo4jItemReader<T> build()
Returns a fully constructedNeo4jItemReader
.- Returns:
- a new
Neo4jItemReader