org.springframework.batch.item.data.builder

## Class RepositoryItemWriterBuilder<T>

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

-     public class RepositoryItemWriterBuilder<T>
      extends java.lang.Object

  A builder implementation for the `RepositoryItemWriter`.
  Since:
    4.0
  Author:
    Glenn Renfro, Mahmoud Ben Hassine
  See Also:
    `RepositoryItemWriter`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RepositoryItemWriterBuilder.RepositoryMethodReference<T>` Establishes a proxy that will capture a the Repository and the associated methodName that will be used by the writer.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RepositoryItemWriterBuilder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RepositoryItemWriter<T>` | `build()` Builds the `RepositoryItemWriter`.
    `RepositoryItemWriterBuilder<T>` | `methodName(java.lang.String methodName)` Specifies what method on the repository to call.
    `RepositoryItemWriterBuilder<T>` | `repository(org.springframework.data.repository.CrudRepository<T,?> repository)` Set the `CrudRepository` implementation for persistence
    `RepositoryItemWriterBuilder<T>` | `repository(RepositoryItemWriterBuilder.RepositoryMethodReference repositoryMethodReference)` Specifies a repository and the type-safe method to call for the writer.

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

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

- - ### Constructor Detail

    - #### RepositoryItemWriterBuilder

          public RepositoryItemWriterBuilder()

  - ### Method Detail

    - #### methodName

          public RepositoryItemWriterBuilder<T> methodName(java.lang.String methodName)

      Specifies what method on the repository to call. This method must have the type of object passed to this writer as the sole argument.
      Parameters:
        `methodName` - the name of the method to be used for saving the item.
      Returns:
        The current instance of the builder.
      See Also:
        `RepositoryItemWriter.setMethodName(String)`

    - #### repository

          public RepositoryItemWriterBuilder<T> repository(org.springframework.data.repository.CrudRepository<T,?> repository)

      Set the `CrudRepository` implementation for persistence
      Parameters:
        `repository` - the Spring Data repository to be set
      Returns:
        The current instance of the builder.
      See Also:
        `RepositoryItemWriter.setRepository(CrudRepository)`

    - #### repository

          public RepositoryItemWriterBuilder<T> repository(RepositoryItemWriterBuilder.RepositoryMethodReference repositoryMethodReference)

      Specifies a repository and the type-safe method to call for the writer. The method configured via this mechanism must take `Pageable` as the last argument. This method can be used in place of `repository(CrudRepository)`, `methodName(String)`}. Note: The repository that is used by the repositoryMethodReference must be non-final.
      Parameters:
        `repositoryMethodReference` - of the used to get a repository and type-safe method for use by the writer.
      Returns:
        The current instance of the builder.
      See Also:
        `RepositoryItemWriter.setMethodName(String)`, `RepositoryItemWriter.setRepository(CrudRepository)`

    - #### build

          public RepositoryItemWriter<T> build()

      Builds the `RepositoryItemWriter`.
      Returns:
        a `RepositoryItemWriter`