org.jboss.shrinkwrap.descriptor.spi.node.Node.deepCopy()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(162)

本文整理了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

Node.deepCopy介绍

[英]Returns a deep copy of this Node
[中]返回此节点的深度副本

代码示例

代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. /**
  2. * Returns a deep copy of this {@link Node}
  3. *
  4. * @return
  5. */
  6. public Node deepCopy() {
  7. // Create new Node
  8. final Node newRoot = new Node(this.getName());
  9. // Set attributes
  10. this.deepCopy(newRoot);
  11. // Return
  12. return newRoot;
  13. }

代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. /**
  2. * Returns a deep copy of this {@link Node}
  3. *
  4. * @return
  5. */
  6. public Node deepCopy() {
  7. // Create new Node
  8. final Node newRoot = new Node(this.getName());
  9. // Set attributes
  10. this.deepCopy(newRoot);
  11. // Return
  12. return newRoot;
  13. }

代码示例来源:origin: org.projectodd.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. /**
  2. * Copies <code>this</code> reference to the specified {@link Node}
  3. * @param copyTarget
  4. * @return
  5. */
  6. private Node deepCopy(final Node copyTarget){
  7. // Precondition checks
  8. assert copyTarget != null : "Node to copy information into must be specified";
  9. // Set attributes
  10. final Map<String, String> attributes = this.getAttributes();
  11. final Set<String> attributeKeys = attributes.keySet();
  12. for (final String key : attributeKeys) {
  13. final String value = attributes.get(key);
  14. copyTarget.attribute(key, value);
  15. }
  16. // Set text
  17. copyTarget.text(this.getText());
  18. // Set children
  19. final List<Node> children = this.getChildren();
  20. for (final Node child : children) {
  21. final Node newChild = copyTarget.createChild(child.getName());
  22. // Recurse in
  23. child.deepCopy(newChild);
  24. }
  25. // Return
  26. return this;
  27. }

代码示例来源:origin: org.jboss.shrinkwrap.descriptors/shrinkwrap-descriptors-spi

  1. /**
  2. * Copies <code>this</code> reference to the specified {@link Node}
  3. * @param copyTarget
  4. * @return
  5. */
  6. private Node deepCopy(final Node copyTarget){
  7. // Precondition checks
  8. assert copyTarget != null : "Node to copy information into must be specified";
  9. // Set attributes
  10. final Map<String, String> attributes = this.getAttributes();
  11. final Set<String> attributeKeys = attributes.keySet();
  12. for (final String key : attributeKeys) {
  13. final String value = attributes.get(key);
  14. copyTarget.attribute(key, value);
  15. }
  16. // Set text
  17. copyTarget.text(this.getText());
  18. // Set children
  19. final List<Node> children = this.getChildren();
  20. for (final Node child : children) {
  21. final Node newChild = copyTarget.createChild(child.getName());
  22. // Recurse in
  23. child.deepCopy(newChild);
  24. }
  25. // Return
  26. return this;
  27. }

相关文章