NodeUtil展开方法

问题描述 投票:0回答:1

此片段中的NodeUtil解包方法有什么作用,对节点有什么影响:

Node node;
if (subMap.get(JcrConstants.JCR_UUID) != null && NodeUtil.unwrap(root) instanceof NodeImpl) {
         final Node unwrapped = NodeUtil.unwrap(root);
         node = ((NodeImpl) unwrapped).addNodeWithUuid(key, nodeType, 
         String.valueOf(subMap.get(JcrConstants.JCR_UUID)));
} else {
         node = root.addNode(key, nodeType);
}
java jcr
1个回答
0
投票

两行

final Node unwrapped = NodeUtil.unwrap(root);
node = ((NodeImpl) unwrapped).addNodeWithUuid(key, nodeType, 
         String.valueOf(subMap.get(JcrConstants.JCR_UUID)));

基本上允许您添加具有特定UUID的注释,而不是系统生成的注释。

© www.soinside.com 2019 - 2024. All rights reserved.