[#1245] Improve formatting for DECIMAL data types in Result.format().

Nicely align the decimal point and reserve space on both sides

Who would say some jUnit test will fail? Cool.
This commit is contained in:
Ivan Dugic 2012-09-01 19:55:08 +02:00
parent d1142d2a62
commit 57ea195109

View File

@ -948,9 +948,12 @@ class ResultImpl<R extends Record> implements Result<R>, AttachableInternal {
Map<Field<?>, Integer> decimalPlacesMap = new HashMap<Field<?>, Integer>();
for (Field<?> f : getFields()) {
if (Number.class.isAssignableFrom(f.getType())) {
// Collect all decimal places for the column values
List<Integer> decimalPlacesList = new ArrayList<Integer>();
// Initialize
decimalPlacesList.add(0);
// Collect all decimal places for the column values
String value;
for (int i = 0; i < min(MAX_RECORDS, size()); i++) {
value = format0(getValue(i, f));