-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add helper to Properties class +cleanups #469
base: main
Are you sure you want to change the base?
Conversation
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.
I would add this method to Play.configuration
, not to Play
.
The the usage will be easier to read:
if (Play.configuration.hasValue("mail.debug", "false", "true"))
than this:
if (configPropWithDefaultEqualsTo("mail.debug", "false", "true"))
Good point will look at it. |
@asolntsev I've looked into it. I've subclassed Properties (the class of Play.configuration) to ConfigurationProperties and tried to use that instead of Properties: this is quite an invasive change. Properties (the one from java.util) is passed around quite a bit and that then should all become ConfigurationProperties. I think the resulting PR will look a lot worse than the one I suggested. Also: there's a Properties implementation in RePlay as well, but that is seemingly unused. |
Sorry, I didn't understand why is this an invasive change? |
@asolntsev I've update the branch. |
@asolntsev wrote:
Good point. I've updated the branch accordingly. |
I dont know why the
Locally this (
Two completely different test failures, that do not occur consistently over the different contexts (local CLI and remote Github CI)... I think all is fine, but somehow things got flaky. |
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.
LGTM!
Nice job @cies
Accepted with one suggestion to rename PropertyResult
-> PropertyValue
.
} | ||
|
||
/** Helper method of an often recurring type of check on Play's configuration properties. */ | ||
public PropertyResult property(final String key, final String defaultValue) { |
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.
@cies I would name this class PropertyValue
, not PropertyResult
.
It seems that the word "result" doesn't bring any value, like "PropertyObject" or "PropertyClass".
We were doing the same thing in many places.
I added a helper method. I can also think of another way to implement this: subclass
Properties
toPlayProperties
and add the helper method there.@xabolcs Sorry for adding some IntelliJ spelling fixes into this PR. I'm very much in the habit of scanning every file I touch for minor cleanup work.