@Override
public String fromObject(Object obj, String resultCode, Writer stream)
throws IOException {
CsvEntityWriterFactory factory = new CsvEntityWriterFactory();
Class<?> entityType = getEntityType(obj);
EntityHandler csvHandler = factory.createWriter(entityType, stream);
List<?> values = getEntityValues(obj);
for (Object value : values)
csvHandler.handleEntity(value);