Skip to content

MongoItemWriter - Add protected getters for "delete" and "collection" properties. Fixes #3973 #4148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

tolpp
Copy link

@tolpp tolpp commented Jul 7, 2022

This PR provides protected getter methods for MongoItemWriter's delete and collection properties. Thus, any custom implementation of MongoItemWriter will be able to extend it's doWrite logic regards to these two properties.

Properties itself are still have private access modifier, but they become accessible from subclass via getters as previously did for template in cae2cab

This PR is related to #3973.

Without this change, developers are not be able to write custom implementation something like

public class CustomMongoItemWriter<T> extends MongoItemWriter<T> {

    @Override
    protected void doWrite(List<? extends T> items) {
        if (isDelete()) {
            super.doWrite(items);
        } else {
            if(getCollection().contains("archive")) {
                // Batch insert without checking existence
            } else {
              super.doWrite(items);  
            }
        }
    }
}

@tolpp tolpp force-pushed the feature/3973_mongo_item_writer_add_protected_getters branch from 81c2319 to 5dfdf5e Compare July 7, 2022 09:31
@fmbenhassine fmbenhassine linked an issue Jul 20, 2022 that may be closed by this pull request
@fmbenhassine
Copy link
Contributor

Superseded by a previous PR, #3975.

Thank you for your contribution anyway!

@fmbenhassine fmbenhassine added the status: superseded Issues that are superseded by other issues label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: infrastructure pr-for: feature status: superseded Issues that are superseded by other issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide accessors in MongoItemWriter to facilitate extensions
2 participants