org.apache.commons.dbutils
クラス BasicRowProcessor

java.lang.Object
  拡張org.apache.commons.dbutils.BasicRowProcessor
すべての実装インタフェース:
RowProcessor

public class BasicRowProcessor
extends Object
implements RowProcessor

RowProcessor インターフェースの基本実装です。 このクラスはスレッドセーフなSingletonです。

Basic implementation of the RowProcessor interface. This class is a thread-safe Singleton.

作成者:
Henri Yandell, Juozas Baliuka, David Graham, Yoav Shapira
関連項目:
RowProcessor
翻訳者:
小川 環
校正者:
日置 聡
翻訳状況:
校正者校正中
翻訳更新日:
2003/12/19

コンストラクタの概要
protected BasicRowProcessor()
          BasicRowProcessorのサブクラスのみを対象としたprotectedスコープのコンストラクタ。
 
メソッドの概要
static BasicRowProcessor instance()
          このクラスのSingletonインスタンスを返します。
 Object[] toArray(ResultSet rs)
          ResultSet の行を Object[] へ変換します。
 Object toBean(ResultSet rs, Class type)
          ResultSet の行をJavaBeanへ変換します。
 List toBeanList(ResultSet rs, Class type)
          ResultSet をJavaBeanの List へ変換します。
 Map toMap(ResultSet rs)
          ResultSet の行を Map へ変換します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

BasicRowProcessor

protected BasicRowProcessor()
BasicRowProcessorのサブクラスのみを対象としたprotectedスコープのコンストラクタ。
Protected constructor for BasicRowProcessor subclasses only.

メソッドの詳細

instance

public static BasicRowProcessor instance()
このクラスのSingletonインスタンスを返します。
Returns the Singleton instance of this class.

戻り値:
このクラスの唯一のインスタンス。
The single instance of this class.

toArray

public Object[] toArray(ResultSet rs)
                 throws SQLException
ResultSet の行を Object[] へ変換します。 この実装は、 ResultSet から返されたカラム値を配列へ同順にコピーします。 カラム値がSQL NULLであれば、配列の要素には null がセットされます。
Convert a ResultSet row into an Object[]. This implementation copies column values into the array in the same order they're returned from the ResultSet. Array elements will be set to null if the column was SQL NULL.

定義:
インタフェース RowProcessor 内の toArray
例外:
SQLException
関連項目:
RowProcessor.toArray(java.sql.ResultSet)

toBean

public Object toBean(ResultSet rs,
                     Class type)
              throws SQLException
ResultSet の行をJavaBeanへ変換します。 この実装では、カラム名とBeanプロパティ名が一致するかどうか判定するために、 リフレクションおよび BeanInfoのクラスを使用しています。 プロパティはいくつかの要因に基づいたカラムと一致します。
Convert a ResultSet row into a JavaBean. This implementation uses reflection and BeanInfo classes to match column names to bean property names. Properties are matched to columns based on several factors:

  1. クラスは、カラムと同じ名称の書込可能なプロパティを持っていること。 名称を比較する際、大小文字を区別しない。
    The class has a writable property with the same name as a column. The name comparison is case insensitive.
  2. プロパティのsetメソッドのパラメータの型とカラムの型が一致すること。 データの型が一致しない場合は、setter メソッドは呼び出されない。
    The property's set method parameter type matches the column type. If the data types do not match, the setter will not be called.

ResultSet よりSQL NULLが返されると、 プリミティブ型の Bean プロパティは、その型のデフォルト値がセットされます。 数値型のフィールドには0がセットされ、boolean 型のフィールドには false がセットされます。 SQL NULLが返されると、オブジェクト型のプロパティには null がセットされます。 これは、 ResultSet の get* メソッドと同一の振る舞いです。

Primitive bean properties are set to their defaults when SQL NULL is returned from the ResultSet. Numeric fields are set to 0 and booleans are set to false. Object bean properties are set to null when SQL NULL is returned. This is the same behavior as the ResultSet get* methods.

定義:
インタフェース RowProcessor 内の toBean
例外:
SQLException
関連項目:
RowProcessor.toBean(java.sql.ResultSet, java.lang.Class)

toBeanList

public List toBeanList(ResultSet rs,
                       Class type)
                throws SQLException
ResultSet をJavaBeanの List へ変換します。 この実装では、カラム名とBeanプロパティ名が一致するかどうか判定するために、 リフレクションおよび BeanInfo のクラスを使用しています。 プロパティはいくつかの要因に基づいたカラムと一致します。
Convert a ResultSet into a List of JavaBeans. This implementation uses reflection and BeanInfo classes to match column names to bean property names. Properties are matched to columns based on several factors:

  1. クラスは、カラムと同じ名称の書込可能なプロパティを持っていること。 名称を比較する際、大小文字を区別しない。
    The class has a writable property with the same name as a column. The name comparison is case insensitive.
  2. プロパティのsetメソッドのパラメータの型とカラムの型が一致すること。 データの型が一致しない場合は、setter メソッドは呼び出されない。
    The property's set method parameter type matches the column type. If the data types do not match, the setter will not be called.

ResultSet よりSQL NULLが返されると、 プリミティブ型の Bean プロパティは、その型のデフォルト値がセットされます。 数値型のフィールドには0がセットされ、boolean 型のフィールドには false がセットされます。 SQL NULLが返されると、オブジェクト型のプロパティには null がセットされます。 これは、ResultSet の get* メソッドと同一の振る舞いです。

Primitive bean properties are set to their defaults when SQL NULL is returned from the ResultSet. Numeric fields are set to 0 and booleans are set to false. Object bean properties are set to null when SQL NULL is returned. This is the same behavior as the ResultSet get* methods.

定義:
インタフェース RowProcessor 内の toBeanList
戻り値:
ResultSet によって返された順序にしたがっている指定された型の Bean の List
A List of beans with the given type in the order they were returned by the ResultSet.
例外:
SQLException
関連項目:
RowProcessor.toBeanList(java.sql.ResultSet, java.lang.Class)

toMap

public Map toMap(ResultSet rs)
          throws SQLException
ResultSet の行を Map へ変換します。 この実装では、大小文字を区別しないカラム名をキーとしたMapを返します。 例えば、map.get("COL") の呼び出しと map.get("col") の呼び出しでは、 同一の値が返されるようになります。
Convert a ResultSet row into a Map. This implementation returns a Map with case insensitive column names as keys. Calls to map.get("COL") and map.get("col") return the same value.

定義:
インタフェース RowProcessor 内の toMap
例外:
SQLException
関連項目:
RowProcessor.toMap(java.sql.ResultSet)


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation