Skip to content

Commit 5dfdf5e

Browse files
author
Tolga Okur
committed
Add protected getters for delete and collection properties. Fixes spring-projects#3973
1 parent 0b2a2c2 commit 5dfdf5e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/data/MongoItemWriter.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ public void setDelete(boolean delete) {
8484
this.delete = delete;
8585
}
8686

87+
/**
88+
* Indicates if the items being passed to the writer are to be saved or removed from
89+
* the data store. If is false (default), the items will be saved. If is true, the
90+
* items will be removed.
91+
* @return removal indicator
92+
*/
93+
protected boolean isDelete() {
94+
return delete;
95+
}
96+
8797
/**
8898
* Set the {@link MongoOperations} to be used to save items to be written.
8999
* @param template the template implementation to be used.
@@ -109,6 +119,14 @@ public void setCollection(String collection) {
109119
this.collection = collection;
110120
}
111121

122+
/**
123+
* Get the name of the Mongo collection to be written to.
124+
* @return the name of the collection.
125+
*/
126+
protected String getCollection() {
127+
return collection;
128+
}
129+
112130
/**
113131
* If a transaction is active, buffer items to be written just before commit.
114132
* Otherwise write items using the provided template.

0 commit comments

Comments
 (0)