[ https://issues.apache.org/jira/browse/OAK-2397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14277481#comment-14277481 ]
Michael Dürig commented on OAK-2397: ------------------------------------ Scrape the idea with the {{TreeBasedNodeState}} in the patch. Implementing {{NodeState}} on top of {{Tree}} obviously violates immutability of the former. > Provide a way to turn Tree instances into a NodeState > ----------------------------------------------------- > > Key: OAK-2397 > URL: https://issues.apache.org/jira/browse/OAK-2397 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: core > Reporter: Michael Dürig > Assignee: Michael Dürig > Attachments: OAK-2397.patch > > > In various places we need to access the underlying node state of an > {{ImmutableTree}} (e.g. in {{MoveAwarePermissionValidator}}). Currently this > is done by down casting from {{Tree}} to {{ImmutableTree}}, which is bad > practice. > I suggest we add a method to the {{TreeFactory}} we introduce with OAK-2391 > to obtain a {{NodeState}} from a {{Tree}}: > {code} > public static NodeState createNodeState(@Nonnull Tree tree){} > {code} > So API consumers don't need to bother about the actual implementation. -- This message was sent by Atlassian JIRA (v6.3.4#6332)