View Javadoc
1   package org.davidmoten.rx.jdbc.callable.internal;
2   
3   import java.sql.ResultSet;
4   
5   import javax.annotation.Nonnull;
6   
7   import org.davidmoten.rx.jdbc.TransactedCallableBuilder.CallableResultSetsNBuilder;
8   import org.davidmoten.rx.jdbc.Util;
9   import org.davidmoten.rx.jdbc.tuple.Tuples;
10  
11  import com.github.davidmoten.guavamini.Preconditions;
12  
13  import io.reactivex.functions.Function;
14  
15  public interface TxGetterN {
16  
17      CallableResultSetsNBuilder get(Function<? super ResultSet, ?> function);
18  
19      default <T> CallableResultSetsNBuilder getAs(@Nonnull Class<T> cls) {
20          Preconditions.checkNotNull(cls, "cls cannot be null");
21          return get(rs -> Util.mapObject(rs, cls, 1));
22      }
23  
24      default <T1, T2> CallableResultSetsNBuilder getAs(@Nonnull Class<T1> cls1,
25              @Nonnull Class<T2> cls2) {
26          return get(Tuples.tuple(cls1, cls2));
27      }
28  
29      default <T1, T2, T3> CallableResultSetsNBuilder getAs(@Nonnull Class<T1> cls1,
30              @Nonnull Class<T2> cls2, @Nonnull Class<T3> cls3) {
31          return get(Tuples.tuple(cls1, cls2, cls3));
32      }
33  
34      default <T1, T2, T3, T4> CallableResultSetsNBuilder getAs(@Nonnull Class<T1> cls1,
35              @Nonnull Class<T2> cls2, @Nonnull Class<T3> cls3, @Nonnull Class<T4> cls4) {
36          return get(Tuples.tuple(cls1, cls2, cls3, cls4));
37      }
38  
39      default <T1, T2, T3, T4, T5> CallableResultSetsNBuilder getAs(@Nonnull Class<T1> cls1,
40              @Nonnull Class<T2> cls2, @Nonnull Class<T3> cls3, @Nonnull Class<T4> cls4, @Nonnull Class<T5> cls5) {
41          return get(Tuples.tuple(cls1, cls2, cls3, cls4, cls5));
42      }
43  
44      default <T1, T2, T3, T4, T5, T6> CallableResultSetsNBuilder getAs(
45              @Nonnull Class<T1> cls1, @Nonnull Class<T2> cls2, @Nonnull Class<T3> cls3, @Nonnull Class<T4> cls4,
46              @Nonnull Class<T5> cls5, @Nonnull Class<T6> cls6) {
47          return get(Tuples.tuple(cls1, cls2, cls3, cls4, cls5, cls6));
48      }
49  
50      default <T1, T2, T3, T4, T5, T6, T7> CallableResultSetsNBuilder getAs(
51              @Nonnull Class<T1> cls1, @Nonnull Class<T2> cls2, @Nonnull Class<T3> cls3, @Nonnull Class<T4> cls4,
52              @Nonnull Class<T5> cls5, @Nonnull Class<T6> cls6, @Nonnull Class<T7> cls7) {
53          return get(Tuples.tuple(cls1, cls2, cls3, cls4, cls5, cls6, cls7));
54      }
55  }