Skip to content
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

MultiResourceItemReader.getCurrentResource() shouldn't be public [BATCH-1664] #1920

spring-issuemaster opened this issue Dec 4, 2010 · 2 comments


Copy link

@spring-issuemaster spring-issuemaster commented Dec 4, 2010

Robert Kasanicky opened BATCH-1664 and commented

There seems to be no reason for this method to be public, probably an implementation overlook. Protected should be appropriate as it's useful for testing and extensions.

Strictly speaking it is a breaking change so I'm scheduling it only for 3.0.

Affects: 2.1.5


This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 8, 2011

Lucas Ward commented

It actually is required. I just had to use it on a batch job I'm writing. In my example, the filename of the resource being read determines some important information about it. It shouldn't, but instead of having that information in a field in one file, there's a file per 'type'. It's mostly because you have to pay for each of the different types individually, so that's likely why they keep them separate. The only option I could use was to create a composite reader that took in a MultiResourceItemReader and called getCurrentResource(), so that it could decorate the item before returning it. The only other option I can think of would involve an interface that extends LineMapper, to allow for the current resource to be passed in as well, but that only makes sense for readers that are delegates of the MRIR, and wouldn't work at all for XML files. I had to reluctantly stick with my composite approach.


This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 9, 2011

Robert Kasanicky commented

OK, I see. I'll leave it as it is then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.