org.tentackle.db
Class CachedDbCursor<T extends DbObject>

java.lang.Object
  extended by org.tentackle.db.SimpleDbCursor<T>
      extended by org.tentackle.db.CachedDbCursor<T>
Type Parameters:
T - the data object class
All Implemented Interfaces:
DbCursor<T>

public class CachedDbCursor<T extends DbObject>
extends SimpleDbCursor<T>

A caching cursor. Objects are kept in a list.


Field Summary
 
Fields inherited from class org.tentackle.db.SimpleDbCursor
db, dbClass, object, rc, rcName, row, rows, rs, withLinkedObjects
 
Constructor Summary
CachedDbCursor(Db db, Class<T> dbClass, ResultSetWrapper rs)
          Creates a caching cursor.
CachedDbCursor(Db db, Class<T> dbClass, ResultSetWrapper rs, boolean withLinkedObjects)
          Creates a caching cursor.
CachedDbCursor(Db db, RemoteDbCursor rc)
          Creates a cached remote Cursor on the client-side.
 
Method Summary
 void close()
          overridden close
 T getObject()
          Gets the cached object at the current row.
 boolean updateObjectOnly(T object)
          Updates the contents of an object at the current row.
 
Methods inherited from class org.tentackle.db.SimpleDbCursor
afterLast, beforeFirst, deleteObject, deleteObjectAt, fetch, finalize, first, getDbClass, getFetchDirection, getFetchSize, getObjectAt, getRow, getRowCount, isAfterLast, isBeforeFirst, isOpen, isRemote, last, newObject, next, previous, setDbContext, setFetchDirection, setFetchSize, setRow, toList, toListAndClose, toString, updateDbContext, updateObject, updateObjectAt
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachedDbCursor

public CachedDbCursor(Db db,
                      Class<T> dbClass,
                      ResultSetWrapper rs,
                      boolean withLinkedObjects)
Creates a caching cursor.

Parameters:
db - the db connection
dbClass - the DbObject class
rs - the resultset
withLinkedObjects - true if load linked objects, false otherwise

CachedDbCursor

public CachedDbCursor(Db db,
                      Class<T> dbClass,
                      ResultSetWrapper rs)
Creates a caching cursor.

Parameters:
db - the db connection
dbClass - the DbObject class
rs - the resultset

CachedDbCursor

public CachedDbCursor(Db db,
                      RemoteDbCursor rc)
Creates a cached remote Cursor on the client-side.

Parameters:
db - the db connection
rc - the remote cursor
Method Detail

close

public void close()
overridden close

Specified by:
close in interface DbCursor<T extends DbObject>
Overrides:
close in class SimpleDbCursor<T extends DbObject>

getObject

public T getObject()
Gets the cached object at the current row.

Specified by:
getObject in interface DbCursor<T extends DbObject>
Overrides:
getObject in class SimpleDbCursor<T extends DbObject>
Returns:
the object

updateObjectOnly

public boolean updateObjectOnly(T object)
Updates the contents of an object at the current row.

Specified by:
updateObjectOnly in interface DbCursor<T extends DbObject>
Overrides:
updateObjectOnly in class SimpleDbCursor<T extends DbObject>
Parameters:
object - the object to be updated
Returns:
true if update done, false if failed


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de