Class MongoItemWriterBuilder<T>
java.lang.Object
org.springframework.batch.item.data.builder.MongoItemWriterBuilder<T>
A builder implementation for the
MongoItemWriter
- Since:
- 4.0
- Author:
- Glenn Renfro, Mahmoud Ben Hassine
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Validates and builds aMongoItemWriter
.collection
(String collection) Set the name of the Mongo collection to be written to.delete
(boolean delete) Deprecated, for removal: This API element is subject to removal in a future version.mode
(MongoItemWriter.Mode mode) Set the operatingMongoItemWriter.Mode
to be applied by this writer.template
(org.springframework.data.mongodb.core.MongoOperations template) Set theMongoOperations
to be used to save items to be written.
-
Constructor Details
-
MongoItemWriterBuilder
public MongoItemWriterBuilder()
-
-
Method Details
-
delete
Deprecated, for removal: This API element is subject to removal in a future version.Usemode(Mode)
instead. Scheduled for removal in v5.3 or later.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:
-
mode
Set the operatingMongoItemWriter.Mode
to be applied by this writer. Defaults toMongoItemWriter.Mode.UPSERT
.- Parameters:
mode
- the mode to be used.- Returns:
- The current instance of the builder
- Since:
- 5.1
- See Also:
-
template
public MongoItemWriterBuilder<T> template(org.springframework.data.mongodb.core.MongoOperations template) Set theMongoOperations
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:
-
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:
-
build
Validates and builds aMongoItemWriter
.- Returns:
- a
MongoItemWriter
-
mode(Mode)
instead.