Interface Jdbc.ResultExtractor<T>

Type Parameters:
T -
All Superinterfaces:
com.landawn.abacus.util.Throwables.Function<ResultSet,T,SQLException>
Enclosing class:
Jdbc
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface Jdbc.ResultExtractor<T> extends com.landawn.abacus.util.Throwables.Function<ResultSet,T,SQLException>
The Interface ResultExtractor.
  • Field Details

  • Method Details

    • apply

      T apply(ResultSet rs) throws SQLException
      In a lot of scenarios, including PreparedQuery/Dao/SQLExecutor, the input ResultSet will be closed after apply(rs) call. So don't save/return the input ResultSet.
      Specified by:
      apply in interface com.landawn.abacus.util.Throwables.Function<ResultSet,T,SQLException>
      Parameters:
      rs -
      Throws:
      SQLException
    • andThen

      default <R> Jdbc.ResultExtractor<R> andThen(com.landawn.abacus.util.Throwables.Function<? super T,? extends R,SQLException> after)
    • toBiResultExtractor

      default Jdbc.BiResultExtractor<T> toBiResultExtractor()
    • toMap

      static <K, V> Jdbc.ResultExtractor<Map<K,V>> toMap(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyExtractor -
      valueExtractor -
      Returns:
    • toMap

      static <K, V, M extends Map<K, V>> Jdbc.ResultExtractor<M> toMap(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, Supplier<? extends M> supplier)
      Type Parameters:
      K - the key type
      V - the value type
      M -
      Parameters:
      keyExtractor -
      valueExtractor -
      supplier -
      Returns:
    • toMap

      static <K, V> Jdbc.ResultExtractor<Map<K,V>> toMap(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, BinaryOperator<V> mergeFunction)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyExtractor -
      valueExtractor -
      mergeFunction -
      Returns:
    • toMap

      static <K, V, M extends Map<K, V>> Jdbc.ResultExtractor<M> toMap(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, BinaryOperator<V> mergeFunction, Supplier<? extends M> supplier)
      Type Parameters:
      K - the key type
      V - the value type
      M -
      Parameters:
      keyExtractor -
      valueExtractor -
      mergeFunction -
      supplier -
      Returns:
    • toMap

      @Deprecated static <K, V, A, D> Jdbc.ResultExtractor<Map<K,D>> toMap(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, Collector<? super V,A,D> downstream)
      Deprecated.
      replaced by groupTo(RowMapper, RowMapper, Collector)
      Type Parameters:
      K - the key type
      V - the value type
      A -
      D -
      Parameters:
      keyExtractor -
      valueExtractor -
      downstream -
      Returns:
      See Also:
    • toMap

      @Deprecated static <K, V, A, D, M extends Map<K, D>> Jdbc.ResultExtractor<M> toMap(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, Collector<? super V,A,D> downstream, Supplier<? extends M> supplier)
      Deprecated.
      replaced by groupTo(RowMapper, RowMapper, Collector, Supplier)
      Type Parameters:
      K - the key type
      V - the value type
      A -
      D -
      M -
      Parameters:
      keyExtractor -
      valueExtractor -
      downstream -
      supplier -
      Returns:
      See Also:
    • toMultimap

      static <K, V> Jdbc.ResultExtractor<com.landawn.abacus.util.ListMultimap<K,V>> toMultimap(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyExtractor -
      valueExtractor -
      Returns:
    • toMultimap

      static <K, V, C extends Collection<V>, M extends com.landawn.abacus.util.Multimap<K, V, C>> Jdbc.ResultExtractor<M> toMultimap(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, Supplier<? extends M> multimapSupplier)
      Type Parameters:
      K - the key type
      V - the value type
      C -
      M -
      Parameters:
      keyExtractor -
      valueExtractor -
      multimapSupplier -
      Returns:
    • groupTo

      static <K, V> Jdbc.ResultExtractor<Map<K,List<V>>> groupTo(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor)
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      keyExtractor -
      valueExtractor -
      Returns:
      Throws:
      SQLException
    • groupTo

      static <K, V, M extends Map<K, List<V>>> Jdbc.ResultExtractor<M> groupTo(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, Supplier<? extends M> supplier)
      Type Parameters:
      K - the key type
      V - the value type
      M -
      Parameters:
      keyExtractor -
      valueExtractor -
      supplier -
      Returns:
    • groupTo

      static <K, V, A, D> Jdbc.ResultExtractor<Map<K,D>> groupTo(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, Collector<? super V,A,D> downstream)
      Type Parameters:
      K - the key type
      V - the value type
      A -
      D -
      Parameters:
      keyExtractor -
      valueExtractor -
      downstream -
      Returns:
    • groupTo

      static <K, V, A, D, M extends Map<K, D>> Jdbc.ResultExtractor<M> groupTo(Jdbc.RowMapper<? extends K> keyExtractor, Jdbc.RowMapper<? extends V> valueExtractor, Collector<? super V,A,D> downstream, Supplier<? extends M> supplier)
      Type Parameters:
      K - the key type
      V - the value type
      A -
      D -
      M -
      Parameters:
      keyExtractor -
      valueExtractor -
      downstream -
      supplier -
      Returns:
    • toList

      static <T> Jdbc.ResultExtractor<List<T>> toList(Jdbc.RowMapper<? extends T> rowMapper)
    • toList

      static <T> Jdbc.ResultExtractor<List<T>> toList(Jdbc.RowFilter rowFilter, Jdbc.RowMapper<? extends T> rowMapper)
    • toList

      @SequentialOnly @Stateful static <T> Jdbc.ResultExtractor<List<T>> toList(Class<? extends T> targetClass)
      It's stateful. Don't save or cache the returned instance for reuse or use it in parallel stream.
      Type Parameters:
      T -
      Parameters:
      targetClass -
      Returns:
    • toMergedList

      @SequentialOnly @Stateful static <T> Jdbc.ResultExtractor<List<T>> toMergedList(Class<? extends T> targetClass)
      It's stateful. Don't save or cache the returned instance for reuse or use it in parallel stream.
      Type Parameters:
      T -
      Parameters:
      targetClass -
      Returns:
      See Also:
      • DataSet.toMergedEntities(Class)
    • toMergedList

      @SequentialOnly @Stateful static <T> Jdbc.ResultExtractor<List<T>> toMergedList(Class<? extends T> targetClass, Collection<String> idPropNamesForMerge)
      It's stateful. Don't save or cache the returned instance for reuse or use it in parallel stream.
      Type Parameters:
      T -
      Parameters:
      targetClass -
      Returns:
      See Also:
      • DataSet.toMergedEntities(Class, Collection, Collection)
    • toDataSet

      @SequentialOnly @Stateful static Jdbc.ResultExtractor<com.landawn.abacus.util.DataSet> toDataSet(Class<?> entityClass)
      It's stateful. Don't save or cache the returned instance for reuse or use it in parallel stream.
      Parameters:
      entityClass -
      Returns:
    • toDataSet

      @SequentialOnly @Stateful static Jdbc.ResultExtractor<com.landawn.abacus.util.DataSet> toDataSet(Class<?> entityClass, Map<String,String> prefixAndFieldNameMap)
    • toDataSet

      static Jdbc.ResultExtractor<com.landawn.abacus.util.DataSet> toDataSet(Jdbc.RowFilter rowFilter)
    • toDataSet

      static Jdbc.ResultExtractor<com.landawn.abacus.util.DataSet> toDataSet(Jdbc.RowExtractor rowExtractor)
    • toDataSet

      static Jdbc.ResultExtractor<com.landawn.abacus.util.DataSet> toDataSet(Jdbc.RowFilter rowFilter, Jdbc.RowExtractor rowExtractor)
    • to

      static <R> Jdbc.ResultExtractor<R> to(com.landawn.abacus.util.Throwables.Function<com.landawn.abacus.util.DataSet,R,SQLException> after)