You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Michael Dürig (JIRA)" <ji...@apache.org> on 2013/11/19 11:45:22 UTC
[jira] [Commented] (OAK-1114) Clarify NodeBuilder.moveTo() contract
[ https://issues.apache.org/jira/browse/OAK-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13826378#comment-13826378 ]
Michael Dürig commented on OAK-1114:
------------------------------------
The remaining issue is really an edge case. It is about how {{NodeBuilder}} instances should handle the case where a node is moved to a descendant of it self. The current contract of the {{moveTo}} method forbids this and mandates the method to return {{false}}. However for the {{MemoryNodeBuilder}} we can't detect this.
What do people think about adapting the contract of {{NodeBuilder.moveTo}} and leave the exact behaviour for such edge cases to the implementation? Oak does check for these in higher levels already anyway.
{code}
/**
* Move this child to a new parent with a new name. When the move succeeded this
* builder has been moved to {@code newParent} as child {@code newName}. Otherwise neither
* this builder nor {@code newParent} are modified.
* <p>
* The move succeeds if both, this builder and {@code newParent} exist, there is no child with
* {@code newName} at {@code newParent} and {@code newParent} is not in the subtree of this
* builder.
* <p>
* The move fails if the this builder or {@code newParent} does not exist or if there is
* already a child {@code newName} at {@code newParent}.
* In all remaining cases (e.g. moving a builder into its own subtree) the behaviour depends
* on the implementation.
*
* @param newParent builder for the new parent.
* @param newName name of this child at the new parent
* @return {@code true} on success, {@code false} otherwise
*/
{code}
> Clarify NodeBuilder.moveTo() contract
> -------------------------------------
>
> Key: OAK-1114
> URL: https://issues.apache.org/jira/browse/OAK-1114
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: core
> Reporter: Michael Dürig
> Assignee: Michael Dürig
> Fix For: 0.12
>
>
> {{NodeBuilder.moveTo()}} currently behaves differently depending on the implementation. We should rectify that, clarify the contract and add respective unit tests.
--
This message was sent by Atlassian JIRA
(v6.1#6144)