database
b2007102101

org.phosphoresce.commons.database.accessor
クラス ResultAccessorAbstract

java.lang.Object
  拡張org.phosphoresce.commons.database.accessor.ResultAccessorAbstract
すべての実装インタフェース:
ResultAccessor
直系の既知のサブクラス:
ResultColumn, ResultColumnDefinition, ResultRow, ResultRowDefinition, ResultTemplateColumn, ResultTemplateRow

public abstract class ResultAccessorAbstract
extends java.lang.Object
implements ResultAccessor

レコードエレメントアクセスクラス抽象クラス

当クラスは各種レコードエレメントサブクラスにおける共通のインタフェース及びフィールドを提供します。
各種エレメントサブクラスはこれを継承して、サブクラスに特化した動作を実装します。

また、上位より必要に応じて渡されたアクセスリスナークラスに対して、各種処理、または状態変更を通知し、 上位のクラスに、これらの変更により各種処理のトリガーを提供する実装を行います。

作成者:
Kitagawa
関連項目:
ResultAccessor, ResultAccessorListener

フィールドの概要
protected  DatabaseError error
          エラーオブジェクト
protected  org.phosphoresce.commons.database.accessor.ResultAccessorListener listener
          状態管理リスナーオブジェクト
protected  org.apache.commons.logging.Log log
          ロガーオブジェクト
protected  java.sql.ResultSet resultSet
          ResultSetオブジェクト
protected  ResultAccessorState state
          レコードアクセッサ状態オブジェクト
 
コンストラクタの概要
protected ResultAccessorAbstract(java.sql.ResultSet resultSet, ResultAccessorState state, org.phosphoresce.commons.database.accessor.ResultAccessorListener listener)
          コンストラクタ
 
メソッドの概要
 DatabaseError getError()
          エラーオブジェクトを取得します。
protected  int getResultSetRowIndex()
          現在アクティブなResultSetオブジェクトの行位置を取得します。
 ResultAccessorState getState()
          レコードアクセッサ状態オブジェクトを取得します。
 boolean hasError()
          エラーオブジェクトを保持するか判定します。
protected  void moveCurser(int rowIndex)
          指定された行位置(ResultSet仕様に伴い、1〜)にカーソルを移動します。
protected  void refreshResult()
          ResultSetが現在提供する内容で自身のオブジェクトフィールドの更新を行います。
protected abstract  void refreshResult(boolean force)
          ResultSetが現在提供する内容で自身のオブジェクトフィールドの更新を行います。
protected abstract  void updateResult()
          自身が保持する内容をResultSetに対して反映します。
protected  boolean validateStateListener()
          状態管理リスナーオブジェクトが有効であるか判定します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

log

protected org.apache.commons.logging.Log log
ロガーオブジェクト


resultSet

protected java.sql.ResultSet resultSet
ResultSetオブジェクト


state

protected ResultAccessorState state
レコードアクセッサ状態オブジェクト


listener

protected org.phosphoresce.commons.database.accessor.ResultAccessorListener listener
状態管理リスナーオブジェクト


error

protected DatabaseError error
エラーオブジェクト

コンストラクタの詳細

ResultAccessorAbstract

protected ResultAccessorAbstract(java.sql.ResultSet resultSet,
                                 ResultAccessorState state,
                                 org.phosphoresce.commons.database.accessor.ResultAccessorListener listener)
                          throws ResultSetAccessException
コンストラクタ

パラメータ:
resultSet - ResultSetオブジェクト
state - 状態管理リスナーオブジェクト
listener - 状態管理リスナーオブジェクト
例外:
ResultSetAccessException - 不正なResultSetオブジェクトを指定した場合に発生
メソッドの詳細

getState

public final ResultAccessorState getState()
レコードアクセッサ状態オブジェクトを取得します。

定義:
インタフェース ResultAccessor 内の getState
戻り値:
レコードアクセッサ状態オブジェクト
関連項目:
ResultAccessor.getState()

hasError

public final boolean hasError()
エラーオブジェクトを保持するか判定します。

定義:
インタフェース ResultAccessor 内の hasError
戻り値:
エラーオブジェクトを保持する場合にtrueを返却
関連項目:
ResultAccessor.hasError()

getError

public final DatabaseError getError()
エラーオブジェクトを取得します。

定義:
インタフェース ResultAccessor 内の getError
戻り値:
エラーオブジェクト
関連項目:
ResultAccessor.getError()

refreshResult

protected final void refreshResult()
                            throws ResultSetAccessException,
                                   IllegalResultSetLocationIndexException,
                                   IllegalResultSetAdjustmentException
ResultSetが現在提供する内容で自身のオブジェクトフィールドの更新を行います。
現在、変更が行われている内容はすべて破棄され、ResultSet上の情報で更新されます。

例外:
ResultSetAccessException - 正常にResultSetへの操作が行えなかった場合に発生
IllegalResultSetLocationIndexException - 不正な位置情報を操作した場合に発生
IllegalResultSetAdjustmentException - ResultSetとの整合性が取られていない場合に発生

refreshResult

protected abstract void refreshResult(boolean force)
                               throws ResultSetAccessException,
                                      IllegalResultSetLocationIndexException,
                                      IllegalResultSetAdjustmentException
ResultSetが現在提供する内容で自身のオブジェクトフィールドの更新を行います。

パラメータ:
force - 状況に関わらず強制的に更新する場合にtrueを指定、エラーの場合に等の状況によっては更新を行わない場合はfalseを指定。この動作は具象クラス設計によって異なります。
例外:
ResultSetAccessException - 正常にResultSetへの操作が行えなかった場合に発生
IllegalResultSetLocationIndexException - 不正な位置情報を操作した場合に発生
IllegalResultSetAdjustmentException - ResultSetとの整合性が取られていない場合に発生

updateResult

protected abstract void updateResult()
                              throws ResultSetAccessException,
                                     IllegalResultSetLocationIndexException,
                                     IllegalResultSetAdjustmentException
自身が保持する内容をResultSetに対して反映します。

例外:
ResultSetAccessException - 正常にResultSetへの操作が行えなかった場合に発生
IllegalResultSetLocationIndexException - 不正な位置情報を操作した場合に発生
IllegalResultSetAdjustmentException - ResultSetとの整合性が取られていない場合に発生

moveCurser

protected final void moveCurser(int rowIndex)
                         throws ResultSetAccessException
指定された行位置(ResultSet仕様に伴い、1〜)にカーソルを移動します。

パラメータ:
rowIndex - 行位置(1〜)
例外:
ResultSetAccessException - 正常にカーソル移動が行えなかった場合に発生

getResultSetRowIndex

protected final int getResultSetRowIndex()
                                  throws ResultSetAccessException
現在アクティブなResultSetオブジェクトの行位置を取得します。

戻り値:
現在アクティブなResultSetオブジェクトの行位置
例外:
ResultSetAccessException - 正常にカーソル移動が行えなかった場合に発生

validateStateListener

protected final boolean validateStateListener()
状態管理リスナーオブジェクトが有効であるか判定します。

戻り値:
状態管理リスナーオブジェクトが有効である場合trueを返却

database
b2007102101