NodeUtil 解包方法



NodeUtil 解包方法在这个狙击中做了什么,对 Node 有什么影响:

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);
}

两行

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

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

最新更新