MCPcopy Index your code
hub / github.com/apache/groovy / print

Method print

src/main/java/groovy/util/NodePrinter.java:71–95  ·  view source on GitHub ↗

Prints the supplied node tree. @param node the node to print

(Node node)

Source from the content-addressed store, hash-verified

69 * @param node the node to print
70 */
71 public void print(Node node) {
72 out.printIndent();
73 printName(node);
74 Map attributes = node.attributes();
75 boolean hasAttributes = attributes != null && !attributes.isEmpty();
76 if (hasAttributes) {
77 printAttributes(attributes);
78 }
79 Object value = node.value();
80 if (value instanceof List) {
81 if (!hasAttributes) {
82 out.print("()");
83 }
84 printList((List) value);
85 } else {
86 if (value instanceof String) {
87 out.print("('");
88 out.print((String) value);
89 out.println("')");
90 } else {
91 out.println("()");
92 }
93 }
94 out.flush();
95 }
96
97 /**
98 * Prints the node name.

Callers 3

printListMethod · 0.95
printNameMethod · 0.45
printAttributesMethod · 0.45

Calls 9

printNameMethod · 0.95
printAttributesMethod · 0.95
printListMethod · 0.95
printIndentMethod · 0.45
attributesMethod · 0.45
isEmptyMethod · 0.45
valueMethod · 0.45
printlnMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected