|
EclipseLink 2.2.0, build 'v20110202-r8913' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.queries.Cursor org.eclipse.persistence.queries.CursoredStream
public class CursoredStream
Purpose: Stream class which is used to deal with large collections returned from TOPLink queries more efficiently.
Responsibilities: Wraps a database result set cursor to provide a stream on the resulting selected objects.
Field Summary | |
---|---|
protected int |
marker
Marker for backing up. |
Fields inherited from class org.eclipse.persistence.queries.Cursor |
---|
executionSession, fields, initiallyConformingIndex, nextRow, objectCollection, policy, position, query, resultSet, selectionCriteriaClone, session, size, statement, translationRow |
Constructor Summary | |
---|---|
CursoredStream()
INTERNAL: Initialize the state of the stream |
|
CursoredStream(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call,
CursoredStreamPolicy policy)
INTERNAL: Initialize the state of the stream |
Method Summary | |
---|---|
boolean |
atEnd()
PUBLIC: Return whether the cursored stream is at its end. |
int |
available()
PUBLIC: Returns the number of objects that can be read from this input without blocking. |
Expression |
buildCountDistinctExpression(java.util.List includeFields,
ExpressionBuilder builder)
INTERNAL: Must build the count on the primary key fields, not * as * is not allowed if there was a distinct. |
void |
clear()
PUBLIC: Release all objects read in so far. |
protected java.util.List<java.lang.Object> |
copy(int startIndex,
int endIndex)
INTERNAL: Answer a list of the elements of the receiver's collection from startIndex to endIndex. |
protected int |
getCursorSize()
INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor. |
protected int |
getInitialReadSize()
INTERNAL: Return the threshold for the stream. |
protected int |
getMarker()
INTERNAL: Return the marker used for mark() & reset() operations. |
int |
getPageSize()
INTERNAL: Return the page size for the stream. |
int |
getPosition()
INTERNAL: Return the position of the stream inside the object collection |
boolean |
hasMoreElements()
PUBLIC: Return whether the cursored stream has any more elements. |
boolean |
hasNext()
PUBLIC: Return whether the cursored stream has any more elements. |
void |
mark(int readAheadLimit)
PUBLIC: Mark the present position in the stream. |
boolean |
markSupported()
PUBLIC: Tests if this input stream supports the mark
and reset methods. |
java.lang.Object |
next()
PUBLIC: Return the next object from the collection, if beyond the read limit read from the cursor. |
java.util.List<java.lang.Object> |
next(int numberOfElements)
PUBLIC: Return a Vector of at most numberOfElements of the next objects from the collection. |
java.lang.Object |
nextElement()
PUBLIC: Return the next object from the collection, if beyond the read limit read from the cursor. |
java.util.Vector |
nextElements(int numberOfElements)
PUBLIC: Return a Vector of at most numberOfElements of the next objects from the collection. |
java.lang.Object |
peek()
PUBLIC: Return the next object in the stream, without incrementing the stream's position. |
java.lang.Object |
read()
PUBLIC: This method differs slightly from conventional read() operation on a Java stream. |
java.util.List<java.lang.Object> |
read(int number)
PUBLIC: This method differs slightly from conventional read() operation on a Java stream. |
void |
releasePrevious()
PUBLIC: Release all objects read in so far. |
void |
reset()
PUBLIC: Repositions this stream to the position at the time the mark method was last called on this stream. |
protected java.lang.Object |
retrieveNextObject()
INTERNAL: Read the next row from the result set. |
protected java.lang.Object |
retrieveNextPage()
INTERNAL: Retrieve and add the next page size of rows to the vector. |
protected void |
setLimits()
INTERNAL: Initialize the stream size and position |
protected void |
setMarker(int value)
INTERNAL: Set the marker used for mark() & reset() operations |
Methods inherited from class org.eclipse.persistence.queries.Cursor |
---|
buildAndRegisterObject, close, finalize, getAccessor, getExecutionSession, getFields, getInitiallyConformingIndex, getObjectCollection, getPolicy, getQuery, getResultSet, getSelectionCriteriaClone, getSession, getStatement, getTranslationRow, isClosed, remove, setExecutionSession, setFields, setInitiallyConformingIndex, setObjectCollection, setPolicy, setPosition, setResultSet, setSelectionCriteriaClone, setSession, setSize, setTranslationRow, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int marker
Constructor Detail |
---|
public CursoredStream()
public CursoredStream(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, CursoredStreamPolicy policy)
Method Detail |
---|
public boolean atEnd() throws DatabaseException
DatabaseException
public int available() throws DatabaseException
DatabaseException
public Expression buildCountDistinctExpression(java.util.List includeFields, ExpressionBuilder builder)
protected java.util.List<java.lang.Object> copy(int startIndex, int endIndex) throws QueryException
QueryException
protected int getCursorSize() throws DatabaseException, QueryException
getCursorSize
in class Cursor
DatabaseException
QueryException
protected int getInitialReadSize()
protected int getMarker()
public int getPageSize()
getPageSize
in class Cursor
public int getPosition()
getPosition
in class Cursor
public boolean hasMoreElements()
public boolean hasNext()
public void mark(int readAheadLimit)
readAheadLimit
- Limit on the number of characters that may be
read while still preserving the mark. Because
the stream's input comes from the database, there
is no actual limit, so this argument is ignored.public boolean markSupported()
mark
and reset
methods. The markSupported
method of InputStream
returns false
.
public java.lang.Object nextElement()
public java.lang.Object next()
public java.util.Vector nextElements(int numberOfElements)
public java.util.List<java.lang.Object> next(int numberOfElements)
public java.lang.Object peek() throws DatabaseException
DatabaseException
public java.lang.Object read() throws DatabaseException, QueryException
-
- throws exception if read pass end of stream
DatabaseException
QueryException
public java.util.List<java.lang.Object> read(int number) throws DatabaseException
number
- - number of objects to be returned
-
- throws exception if read pass end of stream
DatabaseException
public void clear()
clear
in class Cursor
public void releasePrevious()
public void reset()
protected java.lang.Object retrieveNextObject() throws DatabaseException
Cursor
retrieveNextObject
in class Cursor
DatabaseException
protected java.lang.Object retrieveNextPage() throws DatabaseException
DatabaseException
protected void setLimits()
protected void setMarker(int value)
|
EclipseLink 2.2.0, build 'v20110202-r8913' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |