in src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java [253:295]
private void printValue(final PrintWriter out, final int indentLevel, final Object value) {
final String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
if (value instanceof List) {
out.print("( ");
final Iterator<?> it = ((List<?>) value).iterator();
while (it.hasNext()) {
printValue(out, indentLevel + 1, it.next());
if (it.hasNext()) {
out.print(", ");
}
}
out.print(" )");
} else if (value instanceof PropertyListConfiguration) {
final NodeHandler<ImmutableNode> handler = ((PropertyListConfiguration) value).getModel().getNodeHandler();
printNode(out, indentLevel, handler.getRootNode(), handler);
} else if (value instanceof ImmutableConfiguration) {
// display a flat Configuration as a dictionary
out.println();
out.println(padding + "{");
final ImmutableConfiguration config = (ImmutableConfiguration) value;
final Iterator<String> it = config.getKeys();
while (it.hasNext()) {
final String key = it.next();
final ImmutableNode node = new ImmutableNode.Builder().name(key).value(config.getProperty(key)).create();
final InMemoryNodeModel tempModel = new InMemoryNodeModel(node);
printNode(out, indentLevel + 1, node, tempModel.getNodeHandler());
out.println(";");
}
out.println(padding + "}");
} else if (value instanceof Map) {
// display a Map as a dictionary
final Map<String, Object> map = transformMap((Map<?, ?>) value);
printValue(out, indentLevel, new MapConfiguration(map));
} else if (value instanceof byte[]) {
out.print("<" + new String(Hex.encodeHex((byte[]) value)) + ">");
} else if (value instanceof Date) {
out.print(formatDate((Date) value));
} else if (value != null) {
out.print(quoteString(String.valueOf(value)));
}
}