in src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java [391:445]
private void printNode(final PrintWriter out, final int indentLevel, final ImmutableNode node, final NodeHandler<ImmutableNode> handler) {
final String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
if (node.getNodeName() != null) {
out.print(padding + quoteString(node.getNodeName()) + " = ");
}
final List<ImmutableNode> children = new ArrayList<>(node.getChildren());
if (!children.isEmpty()) {
// skip a line, except for the root dictionary
if (indentLevel > 0) {
out.println();
}
out.println(padding + "{");
// display the children
final Iterator<ImmutableNode> it = children.iterator();
while (it.hasNext()) {
final ImmutableNode child = it.next();
printNode(out, indentLevel + 1, child, handler);
// add a semi colon for elements that are not dictionaries
final Object value = child.getValue();
if (value != null && !(value instanceof Map) && !(value instanceof Configuration)) {
out.println(";");
}
// skip a line after arrays and dictionaries
if (it.hasNext() && (value == null || value instanceof List)) {
out.println();
}
}
out.print(padding + "}");
// line feed if the dictionary is not in an array
if (handler.getParent(node) != null) {
out.println();
}
} else if (node.getValue() == null) {
out.println();
out.print(padding + "{ };");
// line feed if the dictionary is not in an array
if (handler.getParent(node) != null) {
out.println();
}
} else {
// display the leaf value
final Object value = node.getValue();
printValue(out, indentLevel, value);
}
}