Package org.springframework.batch.item.data.builder

# Class MongoItemWriterBuilder<T>

java.lang.Object
org.springframework.batch.item.data.builder.MongoItemWriterBuilder<T>

public class MongoItemWriterBuilder<T> extends Object
A builder implementation for the `MongoItemWriter`

Since:
  4.0
Author:
  Glenn Renfro
See Also:
  - `MongoItemWriter`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MongoItemWriterBuilder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `MongoItemWriter<T>`
  `build()`
  Validates and builds a `MongoItemWriter`.
  `MongoItemWriterBuilder<T>`
  `collection(String collection)`
  Set the name of the Mongo collection to be written to.
  `MongoItemWriterBuilder<T>`
  `delete(boolean delete)`
  Indicates if the items being passed to the writer are to be saved or removed from the data store.
  `MongoItemWriterBuilder<T>`
  `template(org.springframework.data.mongodb.core.MongoOperations template)`
  Set the `MongoOperations` to be used to save items to be written.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### MongoItemWriterBuilder

    public MongoItemWriterBuilder()

- ## Method Details

  - ### delete

    public MongoItemWriterBuilder<T> delete(boolean delete)
    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.
    Parameters:
      `delete` - removal indicator
    Returns:
      The current instance of the builder
    See Also:
      - `MongoItemWriter.setDelete(boolean)`

  - ### template

    public MongoItemWriterBuilder<T> template(org.springframework.data.mongodb.core.MongoOperations template)
    Set the `MongoOperations` to be used to save items to be written.
    Parameters:
      `template` - the template implementation to be used.
    Returns:
      The current instance of the builder
    See Also:
      - `MongoItemWriter.setTemplate(MongoOperations)`

  - ### collection

    public MongoItemWriterBuilder<T> collection(String collection)
    Set the name of the Mongo collection to be written to.
    Parameters:
      `collection` - the name of the collection.
    Returns:
      The current instance of the builder
    See Also:
      - `MongoItemWriter.setCollection(String)`

  - ### build

    public MongoItemWriter<T> build()
    Validates and builds a `MongoItemWriter`.
    Returns:
      a `MongoItemWriter`