-
Notifications
You must be signed in to change notification settings - Fork 473
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
[COLLECTIONS-664] Add a class that extend a load method which accept … #33
base: master
Are you sure you want to change the base?
Conversation
1b6ca96
to
9434fd8
Compare
Hello, @kinow, Could you please take a look on this PR? Thanks! |
9434fd8
to
e1e762e
Compare
The CI error seems does not relevant to this PR. |
Hi @zhangminglei ! Sure. Few questions from reviewing the JIRA ticket and the pull request.
The code is well written, and with tests :-) we just need to review the use case, and which component could host it. Hope it helps |
Hello, @kinow Thanks for your reply!
Yes. I will send a message to dev mail list. Thanks |
Thanks for the clear response Minglei! And thanks for your contribution. Let's see what others think 👍 |
Thanks @kinow . I would move this PR to Commons/Configuration. I just not sure which component is the best to put it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is only about reading, I could maybe see a new class called PropertiesFactory that can read not just from a java.io.File but also other inputs like a java.nio.file.Path. Thoughts?
Just had a play with Commons Configuration, and they have some code for handling loading Properties (I think I used version 1, version 2 has builders...). I suspect this feature would at their Haven't looked at the issues in Commons Configuration, but maybe @garydgregory 's suggestion of supporting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too confusing as is IMO.
This is a factory class. It does not need to extend Properties.
Its factory method can be static. The load method is too mysterious since it does not mention resources.
The method also lacks Javadocs.
The stream is opened but not closed, a try-with-resources block is best in this case.
I can take a better look later.
@zhangminglei did you find a home for this contribution. I suspect that it does belong in commons-configuration but want to know if you got it added. |
For example, In some interface, needs we have a
java.util.Properties
as a parameter. In common case, we have different profiles in maven under different environments that we can random selection. And use the current classloader, usually, belongs to AppclassLoader to get itsInputstream
. I propose we should add a functionality that can directly read a file name and return ajava.util.Properties
as a return value.