code: @Override
      public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
          // Validate column count.
          ResultSetMetaData rsmd = rs.getMetaData();
          int nrOfColumns = rsmd.getColumnCount();
          if (nrOfColumns == 0) {
              throw new SQLException("Returned no columns!");
          } else if (nrOfColumns != 1) {
              throw new SQLException("Returned too many columns: "+ nrOfColumns);
          }
  
          // Extract column value from JDBC ResultSet
          Object result = getColumnValue(rs, 1, this.requiredType);
          if ((result != null) && (this.requiredType != null) && !this.requiredType.isInstance(result)) {
              // Extracted value does not match already: try to convert it.
              try {
                  return convertValueToRequiredType(result, this.requiredType);
              }
              catch (IllegalArgumentException ex) {
                  throw new SQLException(
                          "Type mismatch affecting row number " + rowNum + " and column type '" +
                                  rsmd.getColumnTypeName(1) + "': " + ex.getMessage());
              }
          }
          return result;
      }
docs: Extract a value for the single column in the current row.
  <p>Validates that there is only one column selected,
  then delegates to <code>getColumnValue()</code> and also
  <code>convertValueToRequiredType</code>, if necessary.
  
  @see java.sql.ResultSetMetaData#getColumnCount()
  @see #getColumnValue(java.sql.ResultSet,int,Class)
  @see #convertValueToRequiredType(Object,Class)