Add a utility method parseAsTreeMap in NamedPathPruner #630
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently converting a given tree specification into the
NamedPathPruner.Tree
parsing logic is present only theNamedPathPruner
class and not exposed to outside. The parsed valuetree
and it'schildren
are also not exposed outside (imo, it is done from an encapsulation standpoint, which is correct).I have a use cases, I would like to parse the give tree spec, just need the list of keys. Although it would be possible
, [ ]
, but it will lead to logical mismatch between the parsing logic here and the one implemented for a specific use case.children
of thetree
, it is not good.To expose the parsing logic, merely changing the access specifier of methods related to parsing (
parse
,list
,node
etc.) or exposing the parsed value by getter -getTree
orgetChildren
would break the encapsulation and may lead to problems in the downstream code.This PR proposes to add a utility method without modifying any access specifier or changing state related logic.
I have considered alternatives such as,
NamedPathPrunerUtil
to expose the functionalityNamedPathPruner
non-final
)but this proposed solution seems better one.
Testing done
Submitter checklist