Ejemplo n.º 1
0
 private void printRow(Row row, Collection<String> fieldNames, StringBuilder builder) {
   Formater formater = Formater.getInstance();
   builder.setLength(0);
   boolean isFirst = true;
   for (String fieldName : fieldNames) {
     if (isFirst) {
       isFirst = false;
     } else {
       builder.append("\t");
     }
     builder.append(formater.format(row.getFieldValue(fieldName)));
   }
   System.out.println(builder.toString());
 }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 @Override
 public void publishRows(String query, Collection<Row> rows) {
   if (rows.isEmpty()) {
     System.out.println("EMPTY RESULT");
   } else {
     Row firstRow = rows.iterator().next();
     Collection<String> fieldNames = firstRow.getFieldNames();
     StringBuilder builder = new StringBuilder();
     boolean isFirst = true;
     for (String fieldName : fieldNames) {
       if (isFirst) {
         isFirst = false;
       } else {
         builder.append("\t");
       }
       builder.append(fieldName);
     }
     System.out.println(builder.toString());
     System.out.println("\n");
     for (Row row : rows) {
       printRow(row, fieldNames, builder);
     }
   }
 }