本文整理了Java中org.jboss.shrinkwrap.descriptor.spi.node.Node.deepCopy()
方法的一些代码示例,展示了Node.deepCopy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.deepCopy()
方法的具体详情如下:
包路径:org.jboss.shrinkwrap.descriptor.spi.node.Node
类名称:Node
方法名:deepCopy
[英]Returns a deep copy of this Node
[中]返回此节点的深度副本
代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
/**
* Returns a deep copy of this {@link Node}
*
* @return
*/
public Node deepCopy() {
// Create new Node
final Node newRoot = new Node(this.getName());
// Set attributes
this.deepCopy(newRoot);
// Return
return newRoot;
}
代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
/**
* Returns a deep copy of this {@link Node}
*
* @return
*/
public Node deepCopy() {
// Create new Node
final Node newRoot = new Node(this.getName());
// Set attributes
this.deepCopy(newRoot);
// Return
return newRoot;
}
代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
/**
* Copies <code>this</code> reference to the specified {@link Node}
* @param copyTarget
* @return
*/
private Node deepCopy(final Node copyTarget){
// Precondition checks
assert copyTarget != null : "Node to copy information into must be specified";
// Set attributes
final Map<String, String> attributes = this.getAttributes();
final Set<String> attributeKeys = attributes.keySet();
for (final String key : attributeKeys) {
final String value = attributes.get(key);
copyTarget.attribute(key, value);
}
// Set text
copyTarget.text(this.getText());
// Set children
final List<Node> children = this.getChildren();
for (final Node child : children) {
final Node newChild = copyTarget.createChild(child.getName());
// Recurse in
child.deepCopy(newChild);
}
// Return
return this;
}
代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi
/**
* Copies <code>this</code> reference to the specified {@link Node}
* @param copyTarget
* @return
*/
private Node deepCopy(final Node copyTarget){
// Precondition checks
assert copyTarget != null : "Node to copy information into must be specified";
// Set attributes
final Map<String, String> attributes = this.getAttributes();
final Set<String> attributeKeys = attributes.keySet();
for (final String key : attributeKeys) {
final String value = attributes.get(key);
copyTarget.attribute(key, value);
}
// Set text
copyTarget.text(this.getText());
// Set children
final List<Node> children = this.getChildren();
for (final Node child : children) {
final Node newChild = copyTarget.createChild(child.getName());
// Recurse in
child.deepCopy(newChild);
}
// Return
return this;
}
内容来源于网络,如有侵权,请联系作者删除!