UNOMI-400 Refactoring of hardcoded property accessors#218
Conversation
There was a problem hiding this comment.
["foo"].bar is covered
["foo"] is not covered
Also could be great to cover this function with unit test, since it's covering a lot of cases, and it should not be that complicated todo.
There was a problem hiding this comment.
the two else if seem's unecessary if we do:
dotlookupNameEndPos > lookupNameBeginPos || squareBracketlookupNameEndPos > lookupNameBeginPos
in the first condition
There was a problem hiding this comment.
this code is duplicated in the 3 cases, we could move it out of the tree cases and just calculated the lookupNameBeginPos, lookupNameEndPos. inside the 3 cases, then do this code only once at the end.
|
Ok thanks for the feedback Kevan. I've updated this branch with fixes for all the points you raised. Thanks for checking them out. |
* UNOMI-400 Refactoring of hardcoded property accessors * UNOMI-400 More refactoring on property accessors & added unit test (cherry picked from commit 5de4cab)
* UNOMI-400 Refactoring of hardcoded property accessors * UNOMI-400 More refactoring on property accessors & added unit test (cherry picked from commit 5de4cab)
* UNOMI-400 Refactoring of hardcoded property accessors * UNOMI-400 More refactoring on property accessors & added unit test (cherry picked from commit 5de4cab)
* master: (26 commits) Fix typos & Fix Jenkins files Add branch information in main README UNOMI-400 Update documentation to reflect the latest config changes (apache#221) UNOMI-400 Fix class hierarchy lookup for property condition evaluator (apache#220) Return error to the client when exception is thrown from Elasticsearch impl (apache#202) UNOMI-366: Implement increment interest event type & action (apache#201) UNOMI-400 Refactoring of hardcoded property accessors (apache#218) UNOMI-401 Fix missing base class in SecureFilteringClassLoader (apache#219) UNOMI-399: Provide doc inside the custom.system.properties for scripting allow/forbid mechanism (apache#217) UNOMI-400 Fix typo bug in PropertyConditionEvaluator & improve unit test (apache#216) UNOMI-400 More complete hardcoded property accessor implementation (apache#214) UNOMI-401: correctly set ClassLoader before MVEL script execute (apache#215) UNOMI-399: load allow/forbid script from files instead of configuration property to avoid script code conflicting with property value parsing (apache#213) UNOMI-399: fix the loading of MVEL allowed script pattern from config, and return null during script execution if the script is filtered out (apache#211) Add documentation to new security configuration parameters. Add documentation to new security configuration parameters. Remove eslint & dependencies as it is not used. UNOMI-379_support_addValues (apache#207) feat(geo location condition): add support for getting location path f… (#61) (apache#210) ... # Conflicts: # persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java # persistence-elasticsearch/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml # persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg # services/src/main/java/org/apache/unomi/services/impl/segments/SegmentServiceImpl.java
In this PR we externalize the hardcoded property accessors and make better use of polymorphism to make the code cleaner and easier to understand and maintain.