T
- type of the record being returned@NotThreadSafe public interface DBCursor<T> extends Closeable
The cursor provides a java.sql.ResultSet like API : it is positioned before the first requested record and needs to
be moved forward by calling next()
.
Usage:
DBCursor cursor = ...; try { while (cursor.next()) { Record record = cursor.getRecord(); // ... can call cursor.getRecord() again: it will return the same result } } finally { close(cursor); } }A cursor can be initialised from a key, using a
KeyMatchingStrategy
and a PositionStrategy
, to
determine the exact starting position.
Let's call Kp the highest key lower than K and Kn the lowest key higher than K : Kp < K < Kn
Modifier and Type | Interface and Description |
---|---|
static class |
DBCursor.CursorOptions
Options to create a cursor.
|
static class |
DBCursor.KeyMatchingStrategy
Represents a cursor key matching strategy, which allow to choose if only the exact key must be found or if any
key equal or lower/higher should match.
|
static class |
DBCursor.PositionStrategy
Represents a cursor positioning strategy, which allow to choose if the start point corresponds to the record at
the provided key or the record just after the provided key.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Release the resources and locks used by this Iterator.
|
T |
getRecord()
Getter for the current record.
|
boolean |
next()
Skip to the next record of the database.
|
T getRecord()
This method will always return null
when
null
.boolean next() throws ChangelogException
ChangelogException
- When database exception raised.void close()
close
in interface AutoCloseable
close
in interface Closeable
Copyright © 2010–2017 ForgeRock AS. All rights reserved.