class MongoItemWriterBuilder<T> {

	private MongoOperations template;

	private String collection;

	private Mode mode = Mode.UPSERT;

	/**
	 * Indicates if the items being passed to the writer are to be saved or removed from
	 * the data store. If set to false (default), the items will be saved. If set to true,
	 * the items will be removed.
	 * @param delete removal indicator
	 * @return The current instance of the builder
	 * @see MongoItemWriter#setDelete(boolean)
	 * @deprecated Use {@link MongoItemWriterBuilder#mode(Mode)} instead. Scheduled for
	 * removal in v5.3 or later.
	 */
	@Deprecated(since = "5.1", forRemoval = true)
	public MongoItemWriterBuilder<T> delete(boolean delete) {
		this.mode = (delete) ? Mode.REMOVE : Mode.UPSERT;

		return this;
	}

	/**
	 * Set the operating {@link Mode} to be applied by this writer. Defaults to
	 * {@link Mode#UPSERT}.
	 * @param mode the mode to be used.
	 * @return The current instance of the builder
	 * @see MongoItemWriter#setMode(Mode)
	 * @since 5.1
	 */
	public MongoItemWriterBuilder<T> mode(final Mode mode) {
		this.mode = mode;

		return this;
	}

	/**
	 * Set the {@link MongoOperations} to be used to save items to be written.
	 * @param template the template implementation to be used.
	 * @return The current instance of the builder
	 * @see MongoItemWriter#setTemplate(MongoOperations)
	 */
	public MongoItemWriterBuilder<T> template(MongoOperations template) {
		this.template = template;

		return this;
	}

	/**
	 * Set the name of the Mongo collection to be written to.
	 * @param collection the name of the collection.
	 * @return The current instance of the builder
	 * @see MongoItemWriter#setCollection(String)
	 *
	 */
	public MongoItemWriterBuilder<T> collection(String collection) {
		this.collection = collection;

		return this;
	}

	/**
	 * Validates and builds a {@link MongoItemWriter}.
	 * @return a {@link MongoItemWriter}
	 */
	public MongoItemWriter<T> build() {<FILL_FUNCTION_BODY>}

}

		Assert.notNull(this.template, "template is required.");

		MongoItemWriter<T> writer = new MongoItemWriter<>();
		writer.setTemplate(this.template);
		writer.setMode(this.mode);
		writer.setCollection(this.collection);

		return writer;
	
<no_super_class>