code: private void setSpecificFieldsInResult(List<Map<String, Object>> columnsToOutput, EntityMetadata m, List results,
              JsonArray array)
      {
          Map<String, Class> colNameToJavaType = new HashMap<String, Class>();
          for (Map<String, Object> map : columnsToOutput)
          {
              colNameToJavaType.put((String) map.get(Constants.COL_NAME), (Class) map.get(Constants.FIELD_CLAZZ));
          }
          Map<String, List<Object>> outputResults = new HashMap<String, List<Object>>();
          for (JsonElement element : array)
          {
              String column = element.getAsJsonObject().get("key").getAsString();
              String value = element.getAsJsonObject().get("value").getAsString();
              String id = element.getAsJsonObject().get("id").getAsString();
              Object obj = PropertyAccessorHelper.fromSourceToTargetClass(colNameToJavaType.get(column), String.class,
                      value);
              if (colNameToJavaType.size() > 1)
              {
                  if (!outputResults.containsKey(id))
                  {
                      outputResults.put(id, new ArrayList<Object>());
                  }
                  outputResults.get(id).add(obj);
              }
              else
              {
                  results.add(obj);
              }
          }
          if (colNameToJavaType.size() > 1)
          {
              results.addAll(outputResults.values());
          }
      }
docs: Sets the specific fields in result.
  
  @param columnsToOutput
  the columns to output
  @param m
  the m
  @param results
  the results
  @param array
  the array