bindul commented on pull request #684: URL: https://github.com/apache/commons-lang/pull/684#issuecomment-752234673
@garydgregory I have renamed the methods to accept from apply and switched the parameter order where possible. `acceptFirstNonNull` is the analogous method to existing `ObjectUtils.firstNonNull` or `StringUtils.firstNonBlank`. If I remember correctly, I have had one use for this method in my real life code, where a configuration parameter value could be supplied at multiple levels (specific instance, application default or global default; the first two could be null) and I have used a similar method to handle this. If you don't want to include it, I am happy to remove this. In a real life scenario, the use case for the `acceptIfNonNull` method is usually when setting configuration values. The driver (say for something like redis, solr, etc.) or library (like a HTTP client library) accepts a configuration bean with some default values set. Your application accepts configuration values, and you only want to set those in the configuration bean if they are not null (or you lose the default). Anyways, I have updated 3 existing commons-lang classes to show how it can reduce 3 lines of code to 1. I did not go and update every possible occurrence, as that would make this PR large and lose focus on the primary change in the PR. Please review and let me know if I should make further modifications. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
