Class RepositoryItemWriterBuilder<T>
java.lang.Object
org.springframework.batch.item.data.builder.RepositoryItemWriterBuilder<T>
A builder implementation for the
RepositoryItemWriter
.- Since:
- 4.0
- Author:
- Glenn Renfro, Mahmoud Ben Hassine
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Establishes a proxy that will capture a the Repository and the associated methodName that will be used by the writer. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theRepositoryItemWriter
.methodName
(String methodName) Specifies what method on the repository to call.repository
(RepositoryItemWriterBuilder.RepositoryMethodReference repositoryMethodReference) Specifies a repository and the type-safe method to call for the writer.repository
(org.springframework.data.repository.CrudRepository<T, ?> repository) Set theCrudRepository
implementation for persistence
-
Constructor Details
-
RepositoryItemWriterBuilder
public RepositoryItemWriterBuilder()
-
-
Method Details
-
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:
-
repository
public RepositoryItemWriterBuilder<T> repository(org.springframework.data.repository.CrudRepository<T, ?> repository) Set theCrudRepository
implementation for persistence- Parameters:
repository
- the Spring Data repository to be set- Returns:
- The current instance of the builder.
- See Also:
-
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 takePageable
as the last argument. This method can be used in place ofrepository(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:
-
build
Builds theRepositoryItemWriter
.- Returns:
- a
RepositoryItemWriter
-