Module org.tentackle.persistence
Package org.tentackle.persist.rmi
Interface RemoteResultSetCursor<T>
-
- Type Parameters:
T- the type
- All Superinterfaces:
Remote,RemoteDelegate
- All Known Implementing Classes:
RemoteResultSetCursorImpl
public interface RemoteResultSetCursor<T> extends RemoteDelegate
Remote delegate interface forResultSetCursor.- Author:
- harald
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intafterLast()Positions the cursor after the last row.
Works even for empty cursors.voidbeforeFirst()Positions the cursor before the first row.
Works even for empty cursors.voidclose()Closes the scrollable resource.
The scrollable resource is opened in its constructor.ResultSetCursor.FetchList<T>fetch()Fetches the next objects up to the fetchsize.
This method is provided to minimize the number of roundtrips especially for remote cursors.booleanfirst()Rewinds the cursor to the first row.Tget()Gets the data object of the current row.intgetFetchDirection()Gets the fetch direction.intgetFetchSize()Gets the fetchsize.booleanisAfterLast()Checks whether the cursor is after the last row.intlast()Positions the cursor on the last row.booleannext()Moves the cursor to the next row.booleanprevious()Moves the cursor to the previous row.intscroll(int rows)Moves the cursor a given number of rows.voidsetFetchDirection(int direction)Sets the fetch direction.voidsetFetchSize(int rows)Sets the fetchsize.
This is the number of rows the cursor will fetch from the server in one batch.intsetRow(int row)Sets the cursor to a given row.
Row numbers start at 1.List<T>toList()Returns the objects of this cursor as a list.
-
-
-
Method Detail
-
close
void close() throws RemoteExceptionCloses the scrollable resource.
The scrollable resource is opened in its constructor. Closing an already closed scrollable resource is allowed.- Throws:
RemoteException- if failed
-
setRow
int setRow(int row) throws RemoteExceptionSets the cursor to a given row.
Row numbers start at 1.- Parameters:
row- the row number (must be ≥ 0)- Returns:
- the new row number
- Throws:
RemoteException- if failed
-
first
boolean first() throws RemoteExceptionRewinds the cursor to the first row.- Returns:
- true if rewound, false if cursor is empty
- Throws:
RemoteException- if failed
-
last
int last() throws RemoteException
Positions the cursor on the last row.- Returns:
- the current row
- Throws:
RemoteException- if failed
-
next
boolean next() throws RemoteExceptionMoves the cursor to the next row. If there are no more rows the current row remains unchanged.- Returns:
- true if moved, false if no more rows
- Throws:
RemoteException- if failed
-
previous
boolean previous() throws RemoteExceptionMoves the cursor to the previous row. If we are already at the beginning, the cursor remains unchanged.- Returns:
- true if advanced, false if already at the beginning
- Throws:
RemoteException- if failed
-
scroll
int scroll(int rows) throws RemoteExceptionMoves the cursor a given number of rows.- Parameters:
rows- the number of rows to move, negative to move backwards- Returns:
- the current row
- Throws:
RemoteException- if failed
-
beforeFirst
void beforeFirst() throws RemoteExceptionPositions the cursor before the first row.
Works even for empty cursors.- Throws:
RemoteException- if failed
-
afterLast
int afterLast() throws RemoteExceptionPositions the cursor after the last row.
Works even for empty cursors.- Returns:
- the current row
- Throws:
RemoteException- if failed
-
isAfterLast
boolean isAfterLast() throws RemoteExceptionChecks whether the cursor is after the last row.- Returns:
- true if after last
- Throws:
RemoteException- if failed
-
get
T get() throws RemoteException
Gets the data object of the current row.- Returns:
- the object, null if invalid row or no such object
- Throws:
RemoteException- if failed
-
toList
List<T> toList() throws RemoteException
Returns the objects of this cursor as a list.- Returns:
- the list
- Throws:
RemoteException- if failed
-
setFetchSize
void setFetchSize(int rows) throws RemoteExceptionSets the fetchsize.
This is the number of rows the cursor will fetch from the server in one batch. A fetchsize of 0 means server default.- Parameters:
rows- the fetchsize- Throws:
RemoteException- if failed
-
getFetchSize
int getFetchSize() throws RemoteExceptionGets the fetchsize.- Returns:
- the fetchsize
- Throws:
RemoteException- if failed
-
setFetchDirection
void setFetchDirection(int direction) throws RemoteExceptionSets the fetch direction.- Parameters:
direction- the direction, seeResultSet.setFetchDirection(int)- Throws:
RemoteException- if failed
-
getFetchDirection
int getFetchDirection() throws RemoteExceptionGets the fetch direction.- Returns:
- the direction
- Throws:
RemoteException- if failed
-
fetch
ResultSetCursor.FetchList<T> fetch() throws RemoteException
Fetches the next objects up to the fetchsize.
This method is provided to minimize the number of roundtrips especially for remote cursors. The cursor is closed at the end of the cursor.- Returns:
- the list of objects, null if no more objects found
- Throws:
RemoteException- if failed
-
-