private void appendObjectStringify(Writer writer, HollowDataAccess dataAccess, HollowObjectTypeDataAccess typeDataAccess, int ordinal, int indentation) throws IOException {
HollowObjectSchema schema = typeDataAccess.getSchema();
if(schema.numFields() == 1 && (collapseAllSingleFieldObjects || collapseObjectTypes.contains(schema.getName()))) {
appendFieldStringify(writer, dataAccess, indentation, schema, typeDataAccess, ordinal, 0);
} else {
writer.append("{");
boolean firstField = true;
indentation++;
for(int i=0;i<schema.numFields();i++) {
String fieldName = schema.getFieldName(i);
if(!typeDataAccess.isNull(ordinal, i)) {
if(firstField)
firstField = false;
else
writer.append(",");
if(prettyPrint) {
writer.append(NEWLINE);
appendIndentation(writer, indentation);
}
writer.append("\"").append(fieldName).append("\": ");
appendFieldStringify(writer, dataAccess, indentation, schema, typeDataAccess, ordinal, i);
}
}
if(prettyPrint && !firstField) {
writer.append(NEWLINE);
appendIndentation(writer, indentation - 1);
}
writer.append("}");
}
}