package ru.cjdb.printer;

import com.sun.deploy.util.StringUtils;
import ru.cjdb.scheme.types.Type;
import ru.cjdb.sql.cursor.Cursor;
import ru.cjdb.sql.result.QueryResult;
import ru.cjdb.sql.result.Row;

import java.util.*;

/** ResultPrinter implementation for INT
 * Created by flire on 17.10.14.
 */
public class ResultPrinterImpl implements ResultPrinter {
    @Override
    public void print(QueryResult result) {
        if(!result.hasResult()) {
            System.out.println("No result");
        }
        else
        {
            System.out.println("Has result");
            Row currentRow;
            Cursor resultCursor = result.getCursor();
            String format = format(resultCursor.types());
            while((currentRow = resultCursor.nextRow()) != null) {
                System.out.format(format, currentRow.values());
                System.out.println();
            }
        }
    }

    private String format(List<Type> types) {
        List<String> formats = new ArrayList<>();
        for(Type type: types) {
            if(type.name().equals("INT")) {
                formats.add("%10d");
            }
        }
        return StringUtils.join(formats, " ");
    }
}

@@ -34,35 +34,33 @@
 com.
-sun.deploy.util.StringUtils
+google.common.base.Joiner
 ;%0Aim
@@ -213,17 +213,48 @@
 va.util.
-*
+ArrayList;%0Aimport java.util.List
 ;%0A%0A/** R
@@ -1192,19 +1192,22 @@
 urn 
-StringUtils
+Joiner.on(%22 %22)
 .joi
@@ -1219,13 +1219,8 @@
 mats
-, %22 %22
 );%0A 

Fix build