code: public static <T> CachedResultSet chooseFields(Collection<T> collection, String... columns) {
          CachedResultSet rs = new CachedResultSet(columns, new ArrayList<Object[]>());
          for (T object: collection) {
              Object[] row = new Object[columns.length];
              for (int i = 0; i < columns.length; ++i) {
                  try {
                      Object value = Beans.getKnownField(object.getClass(), columns[i]).get(object);
                      if (value != null) {
                          if (value.getClass().isArray()) {
                              row[i] = Strings.join(value, ';');
                          } else {
                              row[i] = value.toString();
                          }
                      } else {
                          row[i] = null;
                      }
                  } catch (Exception x) {
                      row[i] = null;
                  }
              }
              rs.rows.add(row);
          }
  
          return rs;
      }
docs: Retrieves the rows from a collection of Objects, where a subset of the objects' (of type T) <i>public fields</i> are taken as result set columns.
  
  @param <T> the type of the objects in the collection
  @param collection a collection of objects
  @param columns names of a select subset of each object's public fields
  @return the result set from the list of objects