Add NullListQueryMapper.java

This commit is contained in:
Travis Burtrum 2018-10-11 00:58:57 -04:00
parent a378e640ae
commit 7c053176d2
3 changed files with 1098 additions and 4 deletions

View File

@ -64,6 +64,7 @@ query="$(prepareFile "src/main/java/com/moparisthebest/jdbc/QueryMapper.java")"
caching_query="$(prepareFile "src/main/java/com/moparisthebest/jdbc/CachingQueryMapper.java")"
null_query="$(prepareFile "src/main/java/com/moparisthebest/jdbc/NullQueryMapper.java")"
list_query="$(prepareFile "src/main/java/com/moparisthebest/jdbc/ListQueryMapper.java")"
null_list_query="$(prepareFile "src/main/java/com/moparisthebest/jdbc/NullListQueryMapper.java")"
cat src/main/java/com/moparisthebest/jdbc/ResultSetMapper.java | grep public | grep '(ResultSet rs' | egrep -v '(int arrayMaxLength|Calendar cal)' | while read method
do
@ -71,7 +72,7 @@ do
method_name=$(echo $method | egrep -o '[^ ]+\(')
echo "QueryMapper.$method_name)"
[ "$method_name" == 'toStream(' ] && echo -e '\t//IFJAVA8_START\n' | tee -a "$query" "$caching_query" "$null_query" "$list_query" >/dev/null
[ "$method_name" == 'toStream(' ] && echo -e '\t//IFJAVA8_START\n' | tee -a "$query" "$caching_query" "$null_query" "$list_query" "$null_list_query" >/dev/null
# QueryMapper.java
cat >> "$query" <<EOF
@ -124,7 +125,7 @@ EOF
}
EOF
done >> "$null_query"
done | tee -a "$null_query" >> "$null_list_query"
# ListQueryMapper.java
cat >> "$list_query" <<EOF
@ -140,7 +141,7 @@ EOF
EOF
[ "$method_name" == 'toStream(' ] && echo -e '\t//IFJAVA8_END\n' | tee -a "$query" "$caching_query" "$null_query" "$list_query" >/dev/null
[ "$method_name" == 'toStream(' ] && echo -e '\t//IFJAVA8_END\n' | tee -a "$query" "$caching_query" "$null_query" "$list_query" "$null_list_query" >/dev/null
done
@ -148,3 +149,4 @@ finishFile "src/main/java/com/moparisthebest/jdbc/QueryMapper.java"
finishFile "src/main/java/com/moparisthebest/jdbc/CachingQueryMapper.java"
finishFile "src/main/java/com/moparisthebest/jdbc/NullQueryMapper.java"
finishFile "src/main/java/com/moparisthebest/jdbc/ListQueryMapper.java"
finishFile "src/main/java/com/moparisthebest/jdbc/NullListQueryMapper.java"

View File

@ -63,19 +63,32 @@ public class ListQueryMapper extends QueryMapper {
public static final String inListReplace = "{inList}";
private ListQueryMapper(Connection conn, String jndiName, Factory<Connection> factory, QueryMapper delegate, ResultSetMapper cm, InList inList) {
protected ListQueryMapper(Connection conn, String jndiName, Factory<Connection> factory, QueryMapper delegate, ResultSetMapper cm, InList inList) {
this.inList = inList.instance(conn);
this.closeDelegate = delegate == null;
this.delegate = this.closeDelegate ? new QueryMapper(conn, jndiName, factory, cm) :
(delegate instanceof ListQueryMapper ? ((ListQueryMapper)delegate).delegate : delegate);
}
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.delegate = delegate;
this.closeDelegate = closeDelegate;
this.inList = inList;
}
/**
* Only meant to be called by implementing classes
*/
protected ListQueryMapper() {
this.delegate = null;
this.closeDelegate = false;
this.inList = null;
}
public ListQueryMapper(QueryMapper delegate, InList inList) {
this(null, null, null, delegate, null, inList);
}

File diff suppressed because it is too large Load Diff