protected void interpolate(final Node node) { final Map<String, String> attributes = node.astGetAttributes(); for (final Map.Entry<String, String> attribute : attributes.entrySet()) { if (attribute.getValue() != null) attribute.setValue(interpolate(node, attribute.getValue())); } node.astSetAttributes(attributes); for (final String subNodeType : node.astGetNodeTypes()) { for (final Node subNode : node.astGetNodes(subNodeType)) { if (subNode != null) interpolate(subNode); } } }
newNode.astSetAttributes(node.astGetAttributes());
result.astSetAttributes(resultAttrs);
@SuppressWarnings("unchecked") private static <T extends Node> T cloneNodeState(final T node) { // first create a new node instance final T newNode = (T) node.astNewInstance(); // copy node attributes newNode.astSetAttributes(node.astGetAttributes()); // copy node decoration newNode.astSetDecorations(node.astGetDecorations()); // copy source newNode.astSetSource(node.astGetSource()); return newNode; }