S fetchRow()

in dekaf-jdbc/src/impl/JdbcRowFetchers.java [293:319]


    S fetchRow(@NotNull final ResultSet rset) throws SQLException {
      if (myRequiresInit) initGetters(rset.getMetaData());

      try {
        final S struct = structConstructor.newInstance();
        for (int i = 0, n = columnIndices.length; i < n; i++) {
          int columnIndex = columnIndices[i];
          Field f = fields[i];
          JdbcValueGetter<?> g = getters[i];
          if (columnIndex <= 0 || f == null || g == null) continue;
          Object value = g.getValue(rset, columnIndex);
          if (value != null) {
            f.set(struct, value);
          }
        }
        return struct;
      }
      catch (InstantiationException e) {
        throw new UnexpectedReflectionException("Failed to create/populate class " + structClass, e);
      }
      catch (IllegalAccessException e) {
        throw new UnexpectedReflectionException("Failed to create/populate class " + structClass, e);
      }
      catch (InvocationTargetException e) {
        throw new UnexpectedReflectionException("Failed to create/populate class " + structClass, e);
      }
    }