Revert "Delete ListQueryMapper"

This reverts commit 3f4d3121
This commit is contained in:
Travis Burtrum 2019-01-16 10:42:32 -05:00
parent 68db5eda17
commit ca43a27db9
1 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,119 @@
package com.moparisthebest.jdbc;
import com.moparisthebest.jdbc.codegen.JdbcMapper;
import com.moparisthebest.jdbc.util.ResultSetIterable;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
//IFJAVA8_START
import java.util.stream.Stream;
//IFJAVA8_END
public class ListQueryMapper extends QueryMapper {
protected final QueryMapper delegate;
protected final boolean closeDelegate;
public static final String inListReplace = "{inList}";
protected ListQueryMapper(Connection conn, String jndiName, Factory<Connection> factory, final QueryMapper d, ResultSetMapper cm, InList inList, boolean closeDelegate) {
super(d == null ? conn : d.conn, jndiName, factory, d == null ? cm : d.cm, d == null ? inList : d.inList);
this.closeDelegate = closeDelegate;
this.delegate = d;
}
protected ListQueryMapper(Connection conn, String jndiName, Factory<Connection> factory, final QueryMapper d, ResultSetMapper cm, InList inList) {
this(conn, jndiName, factory, d, cm, inList, false);
}
protected ListQueryMapper(Connection conn, String jndiName, Factory<Connection> factory, QueryMapper delegate, ResultSetMapper cm) {
this(conn, jndiName, factory, delegate, cm, defaultInList);
}
public ListQueryMapper(InList inList, QueryMapper delegate, boolean closeDelegate) {
this(null, null, null, delegate, null, inList, closeDelegate);
}
public ListQueryMapper(QueryMapper delegate, InList inList) {
this(null, null, null, delegate, null, inList);
}
public ListQueryMapper(QueryMapper delegate) {
this(null, null, null, delegate, null, defaultInList);
}
public ListQueryMapper(Connection conn, InList inList) {
this(conn, null, null, null, null, inList);
}
public ListQueryMapper(Connection conn, ResultSetMapper cm, InList inList) {
this(conn, null, null, null, cm, inList);
}
public ListQueryMapper(Connection conn) {
this(conn, defaultInList);
}
public ListQueryMapper(Connection conn, ResultSetMapper cm) {
this(conn, cm, defaultInList);
}
public ListQueryMapper(String jndiName, InList inList) {
this(null, jndiName, null, null, null, inList);
}
public ListQueryMapper(String jndiName, ResultSetMapper cm, InList inList) {
this(null, jndiName, null, null, cm, inList);
}
public ListQueryMapper(String jndiName) {
this(jndiName, defaultInList);
}
public ListQueryMapper(String jndiName, ResultSetMapper cm) {
this(jndiName, cm, defaultInList);
}
public ListQueryMapper(Factory<Connection> factory, InList inList) {
this(null, null, factory, null, null, inList);
}
public ListQueryMapper(Factory<Connection> factory, ResultSetMapper cm, InList inList) {
this(null, null, factory, null, cm, inList);
}
public ListQueryMapper(Factory<Connection> factory) {
this(factory, defaultInList);
}
public ListQueryMapper(Factory<Connection> factory, ResultSetMapper cm) {
this(factory, cm, defaultInList);
}
public static ListQueryMapper of(final Factory<QueryMapper> qmFactory, final InList inList) throws SQLException {
return new ListQueryMapper(inList, qmFactory.create(), true);
}
public static ListQueryMapper of(final QueryMapper qm, final InList inList) {
return new ListQueryMapper(inList, qm, false);
}
public static ListQueryMapper of(final Factory<QueryMapper> qmFactory) throws SQLException {
return of(qmFactory, defaultInList);
}
public static ListQueryMapper of(final QueryMapper qm) {
return of(qm, defaultInList);
}
@Override
public void close() {
if(closeDelegate)
delegate.close();
}
}