class JpaCursorItemReaderBuilder<T> {

	private EntityManagerFactory entityManagerFactory;

	private String queryString;

	private JpaQueryProvider queryProvider;

	private Map<String, Object> parameterValues;

	private Map<String, Object> hintValues;

	private boolean saveState = true;

	private String name;

	private int maxItemCount = Integer.MAX_VALUE;

	private int currentItemCount;

	/**
	 * Configure if the state of the {@link ItemStreamSupport} should be persisted within
	 * the {@link ExecutionContext} for restart purposes.
	 * @param saveState defaults to true
	 * @return The current instance of the builder.
	 */
	public JpaCursorItemReaderBuilder<T> saveState(boolean saveState) {
		this.saveState = saveState;

		return this;
	}

	/**
	 * The name used to calculate the key within the {@link ExecutionContext}. Required if
	 * {@link #saveState(boolean)} is set to true.
	 * @param name name of the reader instance
	 * @return The current instance of the builder.
	 * @see ItemStreamSupport#setName(String)
	 */
	public JpaCursorItemReaderBuilder<T> name(String name) {
		this.name = name;

		return this;
	}

	/**
	 * Configure the max number of items to be read.
	 * @param maxItemCount the max items to be read
	 * @return The current instance of the builder.
	 * @see AbstractItemCountingItemStreamItemReader#setMaxItemCount(int)
	 */
	public JpaCursorItemReaderBuilder<T> maxItemCount(int maxItemCount) {
		this.maxItemCount = maxItemCount;

		return this;
	}

	/**
	 * Index for the current item. Used on restarts to indicate where to start from.
	 * @param currentItemCount current index
	 * @return this instance for method chaining
	 * @see AbstractItemCountingItemStreamItemReader#setCurrentItemCount(int)
	 */
	public JpaCursorItemReaderBuilder<T> currentItemCount(int currentItemCount) {
		this.currentItemCount = currentItemCount;

		return this;
	}

	/**
	 * A map of parameter values to be set on the query. The key of the map is the name of
	 * the parameter to be set with the value being the value to be set.
	 * @param parameterValues map of values
	 * @return this instance for method chaining
	 * @see JpaCursorItemReader#setParameterValues(Map)
	 */
	public JpaCursorItemReaderBuilder<T> parameterValues(Map<String, Object> parameterValues) {
		this.parameterValues = parameterValues;

		return this;
	}

	/**
	 * A map of hint values to be set on the query. The key of the map is the name of the
	 * hint to be applied, with the value being the specific setting for that hint.
	 * @param hintValues map of query hints
	 * @return this instance for method chaining
	 * @see JpaCursorItemReader#setHintValues(Map)
	 * @since 5.2
	 */
	public JpaCursorItemReaderBuilder<T> hintValues(Map<String, Object> hintValues) {
		this.hintValues = hintValues;
		return this;
	}

	/**
	 * A query provider. This should be set only if {@link #queryString(String)} have not
	 * been set.
	 * @param queryProvider the query provider
	 * @return this instance for method chaining
	 * @see JpaCursorItemReader#setQueryProvider(JpaQueryProvider)
	 */
	public JpaCursorItemReaderBuilder<T> queryProvider(JpaQueryProvider queryProvider) {
		this.queryProvider = queryProvider;

		return this;
	}

	/**
	 * The JPQL query string to execute. This should only be set if
	 * {@link #queryProvider(JpaQueryProvider)} has not been set.
	 * @param queryString the JPQL query
	 * @return this instance for method chaining
	 * @see JpaCursorItemReader#setQueryString(String)
	 */
	public JpaCursorItemReaderBuilder<T> queryString(String queryString) {
		this.queryString = queryString;

		return this;
	}

	/**
	 * The {@link EntityManagerFactory} to be used for executing the configured
	 * {@link #queryString}.
	 * @param entityManagerFactory {@link EntityManagerFactory} used to create
	 * {@link jakarta.persistence.EntityManager}
	 * @return this instance for method chaining
	 */
	public JpaCursorItemReaderBuilder<T> entityManagerFactory(EntityManagerFactory entityManagerFactory) {
		this.entityManagerFactory = entityManagerFactory;

		return this;
	}

	/**
	 * Returns a fully constructed {@link JpaCursorItemReader}.
	 * @return a new {@link JpaCursorItemReader}
	 */
	public JpaCursorItemReader<T> build() {<FILL_FUNCTION_BODY>}

}

		Assert.notNull(this.entityManagerFactory, "An EntityManagerFactory is required");
		if (this.saveState) {
			Assert.hasText(this.name, "A name is required when saveState is set to true");
		}
		if (this.queryProvider == null) {
			Assert.hasLength(this.queryString, "Query string is required when queryProvider is null");
		}

		JpaCursorItemReader<T> reader = new JpaCursorItemReader<>();
		reader.setEntityManagerFactory(this.entityManagerFactory);
		reader.setQueryProvider(this.queryProvider);
		reader.setQueryString(this.queryString);
		reader.setParameterValues(this.parameterValues);
		reader.setHintValues(this.hintValues);
		reader.setCurrentItemCount(this.currentItemCount);
		reader.setMaxItemCount(this.maxItemCount);
		reader.setSaveState(this.saveState);
		reader.setName(this.name);

		return reader;
	
<no_super_class>