node()
node is a bit redundant, wouldn't it be great if the node name be treated as the default userObject value of the TreeNode? it turns out you can do it, by registering another custom resolver.This case requires you to register a NewInstanceResolver, which will take care of instantiating the nodes, we will use a handy variable exposed by the builder, currentName, to set the node name as the userObject, like this
Ahh much better.
Keep on Groovying!
Update: removed extra single quotes on the node names, they are only needed if the node name contains non-identifier chars.