Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
MultiResourceItemReader.getCurrentResource() shouldn't be public [BATCH-1664] #1920
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.
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.