Change addUnit methods to protected and add one more addUnit method #418
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order for this project to be easily extendable, we can change addUnit methods to protected so that they can be accessed in client applications to add additional units to support the conversions of more unit types.
For the use cases, please see my program: https://github.com/wujiang1900/unit-converter. In particular, please refer to https://github.com/wujiang1900/unit-converter/blob/main/src/main/java/com/challenge/unitconverter/grader/javaximpl/AdditionalUnits.java and see how I'm able to add FAHRENHEIT and RANKINE and support their conversions with the existing CELSIUS unit.
I had to make the changes in this PR and built a new snapshot of indriya to be used in my application to make the above additional unit support working. Therefore please review my PR at your earliest conversion. The code changes below are tiny, but the impact to make indriya flexible and extendable is huge.
Thank you for reviewing!
This change is