Class RemoteResultSetCursorImpl<T extends PersistentDomainObject<T>>
java.lang.Object
org.tentackle.dbms.trip.RemoteDbDelegateImpl<T>
org.tentackle.persist.trip.RemoteResultSetCursorImpl<T>
- Type Parameters:
T- the object type
- All Implemented Interfaces:
RemoteDbDelegate, RemoteResultSetCursor<T>, Remote
public class RemoteResultSetCursorImpl<T extends PersistentDomainObject<T>>
extends RemoteDbDelegateImpl<T>
implements RemoteResultSetCursor<T>
Remote delegate implementation for
ResultSetCursor.- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteResultSetCursorImpl(RemoteDbSessionImpl session, Class<T> clazz) Creates a remote cursor delegate. -
Method Summary
Modifier and TypeMethodDescriptionintPositions the cursor after the last row.
Works even for empty cursors.voidPositions the cursor before the first row.
Works even for empty cursors.voidclose()Closes the scrollable resource.
The scrollable resource is opened in its constructor.voidconfigureDelegate(Object... args) Configures the delegate.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.get()Gets the data object of the current row.Gets the local cursor.intGets the fetch direction.intGets the fetchsize.booleanChecks 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.voidsetCursor(ResultSetCursor<T> cursor) Sets the local cursor.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.toList()Returns the objects of this cursor as a list.toString()Methods inherited from class RemoteDbDelegateImpl
getServerSession, getServicedClass, getSession, initialize
-
Constructor Details
-
RemoteResultSetCursorImpl
Creates a remote cursor delegate.- Parameters:
session- the TRIP sessionclazz- the PDO interface class
-
-
Method Details
-
toString
- Overrides:
toStringin classRemoteDbDelegateImpl<T extends PersistentDomainObject<T>>
-
configureDelegate
Configures the delegate.Invoked from
RemoteDbSessionImpl.createRemoteDelegateInstance(Class, Class, Class, Class, Object...)by reflection.- Parameters:
args- the configuration parameters
-
setCursor
Sets the local cursor.- Parameters:
cursor- the cursor
-
getCursor
-
afterLast
public int afterLast()Description copied from interface:RemoteResultSetCursorPositions the cursor after the last row.
Works even for empty cursors.- Specified by:
afterLastin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the current row
-
beforeFirst
public void beforeFirst()Description copied from interface:RemoteResultSetCursorPositions the cursor before the first row.
Works even for empty cursors.- Specified by:
beforeFirstin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>
-
close
public void close()Description copied from interface:RemoteResultSetCursorCloses the scrollable resource.
The scrollable resource is opened in its constructor. Closing an already closed scrollable resource is allowed.- Specified by:
closein interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>
-
first
public boolean first()Description copied from interface:RemoteResultSetCursorRewinds the cursor to the first row.- Specified by:
firstin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- true if rewound, false if cursor is empty
-
get
Description copied from interface:RemoteResultSetCursorGets the data object of the current row.- Specified by:
getin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the object, null if invalid row or no such object
-
isAfterLast
public boolean isAfterLast()Description copied from interface:RemoteResultSetCursorChecks whether the cursor is after the last row.- Specified by:
isAfterLastin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- true if after last
-
last
public int last()Description copied from interface:RemoteResultSetCursorPositions the cursor on the last row.- Specified by:
lastin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the current row
-
next
public boolean next()Description copied from interface:RemoteResultSetCursorMoves the cursor to the next row. If there are no more rows the current row remains unchanged.- Specified by:
nextin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- true if moved, false if no more rows
-
previous
public boolean previous()Description copied from interface:RemoteResultSetCursorMoves the cursor to the previous row. If we are already at the beginning, the cursor remains unchanged.- Specified by:
previousin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- true if advanced, false if already at the beginning
-
setRow
public int setRow(int row) Description copied from interface:RemoteResultSetCursorSets the cursor to a given row.
Row numbers start at 1.- Specified by:
setRowin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Parameters:
row- the row number (must be ≥ 0)- Returns:
- the new row number
-
scroll
public int scroll(int rows) Description copied from interface:RemoteResultSetCursorMoves the cursor a given number of rows.- Specified by:
scrollin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Parameters:
rows- the number of rows to move, negative to move backwards- Returns:
- the current row
-
toList
Description copied from interface:RemoteResultSetCursorReturns the objects of this cursor as a list.- Specified by:
toListin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the list
-
setFetchSize
public void setFetchSize(int rows) Description copied from interface:RemoteResultSetCursorSets 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.- Specified by:
setFetchSizein interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Parameters:
rows- the fetchsize
-
getFetchSize
public int getFetchSize()Description copied from interface:RemoteResultSetCursorGets the fetchsize.- Specified by:
getFetchSizein interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the fetchsize
-
setFetchDirection
public void setFetchDirection(int direction) Description copied from interface:RemoteResultSetCursorSets the fetch direction.- Specified by:
setFetchDirectionin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Parameters:
direction- the direction, seeResultSet.setFetchDirection(int)
-
getFetchDirection
public int getFetchDirection()Description copied from interface:RemoteResultSetCursorGets the fetch direction.- Specified by:
getFetchDirectionin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the direction
-
fetch
Description copied from interface:RemoteResultSetCursorFetches 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.- Specified by:
fetchin interfaceRemoteResultSetCursor<T extends PersistentDomainObject<T>>- Returns:
- the list of objects, null if no more objects found
-