com.pow2.dao.datalist
Class ResultSetDataListImpl

java.lang.Object
  extended bycom.pow2.dao.AbstractDAO
      extended bycom.pow2.dao.datalist.ResultSetDataListImpl
All Implemented Interfaces:
DataList, ResultSetDataList

public class ResultSetDataListImpl
extends AbstractDAO
implements ResultSetDataList

ResultSetDataListImpl class

Author:
Claudio Fratarcangeli

Field Summary
 
Fields inherited from class com.pow2.dao.AbstractDAO
cat
 
Constructor Summary
ResultSetDataListImpl(ResultSetRowMapper rowMapper, Connection conn, Statement stmt, ResultSet rs)
          Constructor
 
Method Summary
 boolean absolute(int index)
          Move the ResultSetDataList cursor to a specific row number.
 void beforeFirst()
          Move the resultSetDataList cursor before the first row of the list.
 void close()
          Close the data list resultSet, statement, and connection resources.
 boolean elementExists(int index)
          Check if any element exist at the index poition.
 Object get(int index, Object item)
          Put object state in item and return it.
 boolean hasNext()
          Check if the resultSet data list has got another record.
 boolean isEmpty()
          Check if the ResultSetDataList is empty.
 DataListIterator iterator()
          Get the iterator object for this data list.
 
Methods inherited from class com.pow2.dao.AbstractDAO
assertion, closeResources, closeResources, closeResources, count, count, delete, delete, encode, getConnection, getConnection, getNewKey, isDebugEnabled, populate, setLike, setLike
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetDataListImpl

public ResultSetDataListImpl(ResultSetRowMapper rowMapper,
                             Connection conn,
                             Statement stmt,
                             ResultSet rs)
Constructor

Parameters:
rowMapper - the rowMapper instance
conn - the connection object
stmt - the statement object
rs - the resultSet object
Method Detail

iterator

public DataListIterator iterator()
                          throws Exception
Get the iterator object for this data list.

Specified by:
iterator in interface DataList
Returns:
the iterator object for this data list
Throws:
Exception - if any error occurs

get

public Object get(int index,
                  Object item)
           throws Exception
Put object state in item and return it.
Use rowMapper to map fields of ResultSet to instance variables of item. ResultSet index ranges from 1, while ResultSetDataList index ranges from 0.

Specified by:
get in interface DataList
Parameters:
index - the index value, starting from 0
item - the item object to fill
Returns:
the item object filled with values retrieved from the resultSet
Throws:
Exception - if any error occurs

hasNext

public boolean hasNext()
                throws Exception
Check if the resultSet data list has got another record.

Specified by:
hasNext in interface ResultSetDataList
Returns:
true if the resultSet data list has got another record, false otherwise
Throws:
Exception - if any error occurs

beforeFirst

public void beforeFirst()
                 throws Exception
Move the resultSetDataList cursor before the first row of the list.

Specified by:
beforeFirst in interface ResultSetDataList
Throws:
Exception - if any error occurs

absolute

public boolean absolute(int index)
                 throws Exception
Move the ResultSetDataList cursor to a specific row number. Rows are numbered starting from 0.

Specified by:
absolute in interface ResultSetDataList
Parameters:
index - the cursor index value, starting from 0
Returns:
true if the cursor is on the result set; false otherwise
Throws:
Exception - if any error occurs

isEmpty

public boolean isEmpty()
                throws Exception
Check if the ResultSetDataList is empty.

Specified by:
isEmpty in interface DataList
Returns:
The empty value
Throws:
Exception - if any error occurs

elementExists

public boolean elementExists(int index)
                      throws Exception
Check if any element exist at the index poition.
Preserve current location of cursor, find out if element exists and then put cursor back where it was to begin with.

Specified by:
elementExists in interface ResultSetDataList
Parameters:
index - the index value, starting from 0
Returns:
true if any element exist at the index poition, false otherwise
Throws:
Exception - if any error occurs

close

public void close()
           throws Exception
Close the data list resultSet, statement, and connection resources.

Specified by:
close in interface DataList
Throws:
Exception - if any error occurs


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.