-
Notifications
You must be signed in to change notification settings - Fork 549
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
Improved: getConfigParam can't be configured at runtime (OFBIZ-12815) #634
Conversation
In for example InterfaceConfig there are several methods which lead to UtilProperties instead of EntityUtilProperties and therefore cannot be configured during runtime.
Kudos, SonarCloud Quality Gate passed! |
return defaultValue; | ||
} | ||
try { | ||
if (clazz.componentType() == Integer.class) { |
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.
Hello, since it is for trunk and java 17 is available, what do you think about using switch pattern matching (and Guarded Pattern)
ref : https://openjdk.org/jeps/406
Thanks and regards,
Gil
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.
Mmm, i got carried away discovering those new switch syntax :), simple switch are sufficient here, sorry.
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.
Hey Gil,
i closed this PR and opened another one because the commit description was wrong. The new PR: #635
Also i will adjust the existing code with a switch in an upcoming commit in the new PR.
Thanks and regards,
Tobias
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.
Thanks to you Tobias :)
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.
Hey @gilPts ,
i tried to implement the switch statement instead of the if statements and i can't really make it work. The pattern matching documentation in the ref you provided works with objects which have been instantiated before. Maybe stick to the if statements?
Maybe you could provide an example or explain how you would implement such switch statement.
Thanks and regards,
Tobias
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.
Yes pattern matching is not applicable here, hence my second comment, sorry for the misunderstanding. If in those cases are fine, since we are operating on Class
object test...
Thanks
In for example InterfaceConfig there are several methods which lead to UtilProperties instead of EntityUtilProperties and therefore cannot be configured during runtime.
Improved: In for example InterfaceConfig there are several methods which lead to UtilProperties instead of EntityUtilProperties and therefore cannot be configured during runtime. All of these methods don't access the database at all and just reference the UtilProperties methods. I rewrote the methods in EntityUtilProperties so first the database gets checked and if no entry in the database is found the fallback to UtilProperties happens. I left in all the current used methods and just placed my rewritten methods above the current used ones.