1 46 package groovy.util; 47 48 import java.util.ArrayList ; 49 import java.util.Map ; 50 51 58 public class NodeBuilder extends BuilderSupport { 59 60 public static NodeBuilder newInstance() { 61 return new NodeBuilder(); 62 } 63 64 protected void setParent(Object parent, Object child) { 65 } 66 67 protected Object createNode(Object name) { 68 return new Node(getCurrentNode(), name, new ArrayList ()); 69 } 70 71 protected Object createNode(Object name, Object value) { 72 return new Node(getCurrentNode(), name, value); 73 } 74 75 protected Object createNode(Object name, Map attributes) { 76 return new Node(getCurrentNode(), name, attributes, new ArrayList ()); 77 } 78 79 protected Object createNode(Object name, Map attributes, Object value) { 80 return new Node(getCurrentNode(), name, attributes, value); 81 } 82 83 protected Node getCurrentNode() { 84 return (Node) getCurrent(); 85 } 86 } 87 | Popular Tags |