org.apache.commons.dbutils
Class MockResultSet

java.lang.Object
  extended by org.apache.commons.dbutils.MockResultSet
All Implemented Interfaces:
InvocationHandler

public class MockResultSet
extends Object
implements InvocationHandler

MockResultSet dynamically implements the ResultSet interface.


Constructor Summary
MockResultSet(ResultSetMetaData metaData, Object[][] rows)
          MockResultSet constructor.
 
Method Summary
static ResultSet create(ResultSetMetaData metaData, Object[][] rows)
          Create a MockResultSet proxy object.
protected  Object getBoolean(int columnIndex)
          Gets the boolean value at the given column index.
protected  Object getByte(int columnIndex)
          Gets the byte value at the given column index.
protected  Object getDouble(int columnIndex)
          Gets the double value at the given column index.
protected  Object getFloat(int columnIndex)
          Gets the float value at the given column index.
protected  Object getInt(int columnIndex)
          Gets the int value at the given column index.
protected  Object getLong(int columnIndex)
          Gets the long value at the given column index.
protected  ResultSetMetaData getMetaData()
           
protected  Object getObject(int columnIndex)
          Gets the object at the given column index.
protected  Object getShort(int columnIndex)
          Gets the short value at the given column index.
protected  String getString(int columnIndex)
          Gets the String at the given column index.
 Object invoke(Object proxy, Method method, Object[] args)
           
protected  Boolean isLast()
           
protected  Boolean next()
           
protected  Boolean wasNull()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockResultSet

public MockResultSet(ResultSetMetaData metaData,
                     Object[][] rows)
MockResultSet constructor.

Parameters:
metaData -
rows - A null value indicates an empty ResultSet.
Method Detail

create

public static ResultSet create(ResultSetMetaData metaData,
                               Object[][] rows)
Create a MockResultSet proxy object. This is equivalent to:
 ProxyFactory.instance().createResultSet(new MockResultSet(metaData, rows));
 

Parameters:
metaData -
rows - A null value indicates an empty ResultSet.

getBoolean

protected Object getBoolean(int columnIndex)
                     throws SQLException
Gets the boolean value at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

getByte

protected Object getByte(int columnIndex)
                  throws SQLException
Gets the byte value at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

getDouble

protected Object getDouble(int columnIndex)
                    throws SQLException
Gets the double value at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

getFloat

protected Object getFloat(int columnIndex)
                   throws SQLException
Gets the float value at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

getInt

protected Object getInt(int columnIndex)
                 throws SQLException
Gets the int value at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

getLong

protected Object getLong(int columnIndex)
                  throws SQLException
Gets the long value at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

getMetaData

protected ResultSetMetaData getMetaData()
                                 throws SQLException
Throws:
SQLException

getObject

protected Object getObject(int columnIndex)
                    throws SQLException
Gets the object at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

getShort

protected Object getShort(int columnIndex)
                   throws SQLException
Gets the short value at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

getString

protected String getString(int columnIndex)
                    throws SQLException
Gets the String at the given column index.

Parameters:
columnIndex - A 1 based index.
Throws:
SQLException - if a database access error occurs

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

isLast

protected Boolean isLast()
                  throws SQLException
Throws:
SQLException

next

protected Boolean next()
                throws SQLException
Throws:
SQLException

wasNull

protected Boolean wasNull()
                   throws SQLException
Throws:
SQLException


Copyright © 2002-2009 Apache Software Foundation. All Rights Reserved.