Replaces the current node with nodes defined using builder-style notation via a Closure. @param c A Closure defining the new nodes using builder-style notation. @return the original now replaced node
(Closure c)
| 228 | * @return the original now replaced node |
| 229 | */ |
| 230 | public Node replaceNode(Closure c) { |
| 231 | if (parent() == null) { |
| 232 | throw new UnsupportedOperationException("Replacing the root node is not supported"); |
| 233 | } |
| 234 | appendNodes(c); |
| 235 | getParentList(parent()).remove(this); |
| 236 | this.setParent(null); |
| 237 | return this; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Replaces the current node with the supplied node. |
nothing calls this directly
no test coverage detected