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.
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.
Mmm, i got carried away discovering those new switch syntax :), simple switch are sufficient here, sorry.
There was a problem hiding this comment.
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.
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.
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.