Print strings with quotation marks.

This commit is contained in:
Kristian S. Stangeland 2012-11-03 06:59:47 +01:00
parent 72bfa3da9b
commit f2e078ce6a

View File

@ -154,15 +154,17 @@ public class PrettyPrinter {
// Just print primitive types
if (value == null) {
output.append("NULL");
} else if (type.isPrimitive() || Primitives.isWrapperType(type) || type == String.class || hierachyIndex <= 0) {
} else if (type.isPrimitive() || Primitives.isWrapperType(type)) {
output.append(value);
} else if (type == String.class || hierachyIndex <= 0) {
output.append("\"" + value + "\"");
} else if (type.isArray()) {
printArray(output, value, type, stop, previous, hierachyIndex);
} else if (Iterable.class.isAssignableFrom(type)) {
printIterables(output, (Iterable) value, type, stop, previous, hierachyIndex);
} else if (ClassLoader.class.isAssignableFrom(type) || previous.contains(value)) {
// Don't print previous objects
output.append(value);
output.append("\"" + value + "\"");
} else {
output.append("{ ");
printObject(output, value, value.getClass(), stop, previous, hierachyIndex);