public String formatValue(Object s) {
return s == null ? "" : String.valueOf(s);
}
});
formatters.put("D", new FieldFormatter() {
private final ConcurrentDateFormatAccess dateFormat = new ConcurrentDateFormatAccess("dd.MM.yyyy");
@Override
public String formatValue(Object s) {
if (!(s instanceof String)) {
return "";
}
String str = (String) s;
long time;
try {
time = Long.parseLong(str);
} catch (NumberFormatException e) {
return "Bad date(1)";
}
if (time <= 0) {
return "Bad date(2)";
}
Date date = new Date(time);
return dateFormat.format(date);
}
});
}