@Test public void shouldFormatRegularFields() { FieldDto strField = FieldTestHelper.fieldDto("name", String.class); assertEquals("test string", exportCustomizer.formatField(strField, "test string")); FieldDto intField = FieldTestHelper.fieldDto("name", Integer.class); assertEquals("20" , exportCustomizer.formatField(intField, 20)); FieldDto lcField = FieldTestHelper.fieldDto("name", Locale.class); assertEquals(Locale.ENGLISH.toString() , exportCustomizer.formatField(lcField, Locale.ENGLISH)); final DateTime now = DateUtil.now(); FieldDto dtField = FieldTestHelper.fieldDto("name", DateTime.class); assertEquals(now.toString() , exportCustomizer.formatField(dtField, now)); final LocalDate today = DateUtil.today(); FieldDto ldField = FieldTestHelper.fieldDto("name", LocalDate.class); assertEquals(today.toString() , exportCustomizer.formatField(ldField, today)); }
@Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); }
DefaultCsvExportCustomizer implements CsvExportCustomizer { @Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); } }
DefaultCsvExportCustomizer implements CsvExportCustomizer { @Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); }  }
DefaultCsvExportCustomizer implements CsvExportCustomizer { @Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); }  @Override String formatField(FieldDto fieldDto, Object object); @Override Comparator<FieldDto> columnOrderComparator(BrowsingSettingsDto browsingSettingsDto); @Override String exportDisplayName(FieldDto fieldDto); }
DefaultCsvExportCustomizer implements CsvExportCustomizer { @Override public String formatField(FieldDto fieldDto, Object object) { Object displayValue = DisplayHelper.getDisplayValueForField(fieldDto, object); if (displayValue == null) { displayValue = object; } else if (displayValue instanceof Map) { Map asMap = (Map) displayValue; displayValue = asMap.values(); } return TypeHelper.format(displayValue, COLL_JOIN_CHAR); }  @Override String formatField(FieldDto fieldDto, Object object); @Override Comparator<FieldDto> columnOrderComparator(BrowsingSettingsDto browsingSettingsDto); @Override String exportDisplayName(FieldDto fieldDto);  }