woolpack.sql.fn
クラス SqlFnUtils

java.lang.Object
  上位を拡張 woolpack.sql.fn.SqlFnUtils

public class SqlFnUtils
extends Object

RDB にアクセスする部品のユーティリティです。


フィールドの概要
static Fn<Statement,Integer,SQLException> GET_COUNT
          Statement.getUpdateCount()で更新された数を返す関数です。
static Fn<ResultSet,Object,SQLException> GET_SINGLE
          現在の行の最初の列の値を返す関数です。
 
メソッドの概要
static
<R> Fn<ResultSet,R,Exception>
getBeanResult(Fn<? super ResultSet,? extends R,? extends Exception> beanFactory)
          現在の行をBeanにコピーして返す関数を生成します。
static
<R> Fn<ResultSet,R,Exception>
getBeanResult(Fn<? super ResultSet,? extends R,? extends Exception> beanFactory, Fn<String,EL,? extends Exception> elFactory)
          現在の行をBeanにコピーして返す関数を生成します。
static
<R> Fn<Statement,List<R>,Exception>
getList(Fn<? super ResultSet,? extends R,? extends Exception> fn, Fn<? super SQLException,?,? extends Exception> errorFn)
          Statement.getResultSet()ResultSet.next()でカーソルを移動しながら 委譲先にレコード情報の生成を委譲して、 その結果をListに格納して返す関数を生成します。
static
<R> Fn<Statement,List<R>,Exception>
getList(Fn<? super ResultSet,? extends R,? extends Exception> rowFn, int max, Fn<? super SQLException,?,? extends Exception> errorFn)
          Statement.getResultSet()ResultSet.next()でカーソルを移動しながら 委譲先にレコード情報の生成を委譲して、 その結果をListに格納して返す関数を生成します。
static
<R> Fn<Statement,R,Exception>
getOne(Fn<? super ResultSet,? extends R,? extends Exception> rowFn, Fn<? super SQLException,?,? extends Exception> errorFn)
          検索結果を一行だけ取得して返す関数を生成します。
static
<C,R> Fn<C,R,Exception>
inputBean(DataSource dataSource, Fn<? super C,? extends PreparedStatementInfo,? extends Exception> queryFactory, Fn<? super PreparedStatement,? extends R,? extends Exception> converter, Fn<? super SQLException,?,? extends Exception> errorFn)
          委譲先からPreparedStatementInfoを取得し、引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、返却値の生成を委譲する関数を生成します。
static
<C,R> Fn<C,R,Exception>
inputBean(DataSource dataSource, Fn<? super C,? extends PreparedStatementInfo,? extends Exception> queryFactory, Fn<? super PreparedStatement,? extends R,? extends Exception> converter, Fn<? super SQLException,?,? extends Exception> errorFn, Fn<String,? extends GettingEL,? extends Exception> elFactory)
          委譲先からPreparedStatementInfoを取得し、引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、返却値の生成を委譲する関数を生成します。
static
<C,R> Fn<C,R,Exception>
inputBean(DataSource dataSource, PreparedStatementInfo info, Fn<? super PreparedStatement,? extends R,? extends Exception> converter, Fn<? super SQLException,?,? extends Exception> errorFn)
          委譲先からPreparedStatementInfoを取得し、引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、返却値の生成を委譲する関数を生成します。
static
<C,R> Fn<C,R,Exception>
inputSingle(DataSource dataSource, Fn<? super C,? extends String,? extends Exception> queryFactory, Fn<? super PreparedStatement,? extends R,? extends Exception> converter, Fn<? super SQLException,?,? extends Exception> errorFn)
          委譲先からクエリを取得し、 引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、 返却値の生成を委譲する関数を生成します。
static
<C,R> Fn<C,R,Exception>
inputSingle(DataSource dataSource, String query, Fn<? super PreparedStatement,? extends R,? extends Exception> converter, Fn<? super SQLException,?,? extends Exception> errorFn)
          委譲先からクエリを取得し、 引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、 返却値の生成を委譲する関数を生成します。
static
<C,R> Fn<C,R,Exception>
inputStatement(DataSource dataSource, Fn<? super C,? extends String,? extends Exception> queryFactory, Fn<? super Statement,? extends R,? extends Exception> converter, Fn<? super SQLException,?,? extends Exception> errorFn)
          委譲先からクエリを取得して Statement.execute(String)を実行し、 返却値の生成を委譲する関数を生成します。
static
<C,R> Fn<C,R,Exception>
inputStatement(DataSource dataSource, String query, Fn<? super Statement,? extends R,? extends Exception> converter, Fn<? super SQLException,?,? extends Exception> errorFn)
          委譲先からクエリを取得して Statement.execute(String)を実行し、 返却値の生成を委譲する関数を生成します。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

GET_COUNT

public static final Fn<Statement,Integer,SQLException> GET_COUNT
Statement.getUpdateCount()で更新された数を返す関数です。


GET_SINGLE

public static final Fn<ResultSet,Object,SQLException> GET_SINGLE
現在の行の最初の列の値を返す関数です。

メソッドの詳細

getBeanResult

public static <R> Fn<ResultSet,R,Exception> getBeanResult(Fn<? super ResultSet,? extends R,? extends Exception> beanFactory)
現在の行をBeanにコピーして返す関数を生成します。 値の設定にELを使用するため、Mapの入力にも対応しています。

型パラメータ:
R -
パラメータ:
beanFactory - Beanのファクトリ。
戻り値:
関数。
関連項目:
getBeanResult(Fn, Fn)

getBeanResult

public static <R> Fn<ResultSet,R,Exception> getBeanResult(Fn<? super ResultSet,? extends R,? extends Exception> beanFactory,
                                                          Fn<String,EL,? extends Exception> elFactory)
現在の行をBeanにコピーして返す関数を生成します。 値の設定にELを使用するため、Mapの入力にも対応しています。
適用しているデザインパターン:Abstract Factoryにオブジェクトの生成を委譲する。

型パラメータ:
R -
パラメータ:
beanFactory - Beanのファクトリ。
elFactory - プロパティ名からELを生成するファクトリ。
戻り値:
関数。

getList

public static <R> Fn<Statement,List<R>,Exception> getList(Fn<? super ResultSet,? extends R,? extends Exception> rowFn,
                                                          int max,
                                                          Fn<? super SQLException,?,? extends Exception> errorFn)
Statement.getResultSet()ResultSet.next()でカーソルを移動しながら 委譲先にレコード情報の生成を委譲して、 その結果をListに格納して返す関数を生成します。
適用しているデザインパターン:FnのComposite。

型パラメータ:
R -
パラメータ:
rowFn - 委譲先。
max - 最大この数までResultSet.next()を呼び出す閾値。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
戻り値:
関数。

getList

public static <R> Fn<Statement,List<R>,Exception> getList(Fn<? super ResultSet,? extends R,? extends Exception> fn,
                                                          Fn<? super SQLException,?,? extends Exception> errorFn)
Statement.getResultSet()ResultSet.next()でカーソルを移動しながら 委譲先にレコード情報の生成を委譲して、 その結果をListに格納して返す関数を生成します。 最大Integer.MAX_VALUEResultSet.next()を呼び出します。

型パラメータ:
R -
パラメータ:
fn - 委譲先。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
戻り値:
関数。
関連項目:
getList(Fn, int, Fn)

inputBean

public static <C,R> Fn<C,R,Exception> inputBean(DataSource dataSource,
                                                Fn<? super C,? extends PreparedStatementInfo,? extends Exception> queryFactory,
                                                Fn<? super PreparedStatement,? extends R,? extends Exception> converter,
                                                Fn<? super SQLException,?,? extends Exception> errorFn,
                                                Fn<String,? extends GettingEL,? extends Exception> elFactory)
委譲先からPreparedStatementInfoを取得し、引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、返却値の生成を委譲する関数を生成します。 値の設定にGettingELを使用するため、Mapの入力にも対応しています。
適用しているデザインパターン:FnのComposite。

型パラメータ:
C -
R -
パラメータ:
dataSource - データソース。
queryFactory - クエリ情報生成の委譲先。
converter - 変換の委譲先。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
elFactory - 引数から値を取得するためのGettingELのファクトリ。
戻り値:
関数。

inputBean

public static <C,R> Fn<C,R,Exception> inputBean(DataSource dataSource,
                                                Fn<? super C,? extends PreparedStatementInfo,? extends Exception> queryFactory,
                                                Fn<? super PreparedStatement,? extends R,? extends Exception> converter,
                                                Fn<? super SQLException,?,? extends Exception> errorFn)
委譲先からPreparedStatementInfoを取得し、引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、返却値の生成を委譲する関数を生成します。 値の設定にGettingELを使用するため、Mapの入力にも対応しています。
適用しているデザインパターン:FnのComposite。

型パラメータ:
C -
R -
パラメータ:
dataSource - データソース。
queryFactory - クエリ情報生成の委譲先。
converter - 変換の委譲先。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
戻り値:
関数。

inputBean

public static <C,R> Fn<C,R,Exception> inputBean(DataSource dataSource,
                                                PreparedStatementInfo info,
                                                Fn<? super PreparedStatement,? extends R,? extends Exception> converter,
                                                Fn<? super SQLException,?,? extends Exception> errorFn)
委譲先からPreparedStatementInfoを取得し、引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、返却値の生成を委譲する関数を生成します。 値の設定にGettingELを使用するため、Mapの入力にも対応しています。

型パラメータ:
C -
R -
パラメータ:
dataSource - データソース。
info - クエリ情報。
converter - 変換の委譲先。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
戻り値:
関数。
関連項目:
inputBean(DataSource, Fn, Fn, Fn)

getOne

public static <R> Fn<Statement,R,Exception> getOne(Fn<? super ResultSet,? extends R,? extends Exception> rowFn,
                                                   Fn<? super SQLException,?,? extends Exception> errorFn)
検索結果を一行だけ取得して返す関数を生成します。
適用しているデザインパターン:FnのComposite。

型パラメータ:
R -
パラメータ:
rowFn - 一行を返却値に変換する委譲先。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
戻り値:
関数。

inputSingle

public static <C,R> Fn<C,R,Exception> inputSingle(DataSource dataSource,
                                                  Fn<? super C,? extends String,? extends Exception> queryFactory,
                                                  Fn<? super PreparedStatement,? extends R,? extends Exception> converter,
                                                  Fn<? super SQLException,?,? extends Exception> errorFn)
委譲先からクエリを取得し、 引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、 返却値の生成を委譲する関数を生成します。
適用しているデザインパターン:FnのComposite。

型パラメータ:
C -
R -
パラメータ:
dataSource - データソース。
queryFactory - クエリ生成の委譲先。
converter - 変換の委譲先。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
戻り値:
関数。

inputSingle

public static <C,R> Fn<C,R,Exception> inputSingle(DataSource dataSource,
                                                  String query,
                                                  Fn<? super PreparedStatement,? extends R,? extends Exception> converter,
                                                  Fn<? super SQLException,?,? extends Exception> errorFn)
委譲先からクエリを取得し、 引数をPreparedStatementに設定して PreparedStatement.execute()を実行し、 返却値の生成を委譲する関数を生成します。

型パラメータ:
C -
R -
パラメータ:
dataSource - データソース。
query - クエリ。
converter - 変換の委譲先。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
戻り値:
関数。
関連項目:
inputSingle(DataSource, Fn, Fn, Fn)

inputStatement

public static <C,R> Fn<C,R,Exception> inputStatement(DataSource dataSource,
                                                     Fn<? super C,? extends String,? extends Exception> queryFactory,
                                                     Fn<? super Statement,? extends R,? extends Exception> converter,
                                                     Fn<? super SQLException,?,? extends Exception> errorFn)
委譲先からクエリを取得して Statement.execute(String)を実行し、 返却値の生成を委譲する関数を生成します。
適用しているデザインパターン:FnのComposite。

型パラメータ:
C -
R -
パラメータ:
dataSource - データソース。
queryFactory - クエリ生成の委譲先。
converter - 変換の委譲先。
errorFn - SQLExceptionが発生した場合の委譲先。1回のFn.exec(Object)呼び出しで複数回委譲する可能性があります。
戻り値:
関数。

inputStatement

public static <C,R> Fn<C,R,Exception> inputStatement(DataSource dataSource,
                                                     String query,
                                                     Fn<? super Statement,? extends R,? extends Exception> converter,
                                                     Fn<? super SQLException,?,? extends Exception> errorFn)
委譲先からクエリを取得して Statement.execute(String)を実行し、 返却値の生成を委譲する関数を生成します。

型パラメータ:
C -
R -
パラメータ:
dataSource - データソース。
query - クエリ。
converter - 変換の委譲先。
戻り値:
関数。
関連項目:
inputStatement(DataSource, Fn, Fn, Fn)


Copyright (C) 2006-2007 Takahiro Nakamura. All rights reserved.