Class DefaultCursor<T>
- java.lang.Object
-
- org.apache.ibatis.cursor.defaults.DefaultCursor<T>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<T>
,Cursor<T>
public class DefaultCursor<T> extends java.lang.Object implements Cursor<T>
This is the default implementation of a MyBatis Cursor. This implementation is not thread safe.- Author:
- Guillaume Darmont / guillaume@dropinocean.com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DefaultCursor.CursorIterator
protected static class
DefaultCursor.ObjectWrapperResultHandler<T>
-
Field Summary
Fields Modifier and Type Field Description protected DefaultCursor.ObjectWrapperResultHandler<T>
objectWrapperResultHandler
-
Constructor Summary
Constructors Constructor Description DefaultCursor(DefaultResultSetHandler resultSetHandler, ResultMap resultMap, ResultSetWrapper rsw, RowBounds rowBounds)
-
Method Summary
Modifier and Type Method Description void
close()
protected T
fetchNextObjectFromDatabase()
protected T
fetchNextUsingRowBound()
int
getCurrentIndex()
Get the current item index.boolean
isConsumed()
boolean
isOpen()
java.util.Iterator<T>
iterator()
-
-
-
Field Detail
-
objectWrapperResultHandler
protected final DefaultCursor.ObjectWrapperResultHandler<T> objectWrapperResultHandler
-
-
Constructor Detail
-
DefaultCursor
public DefaultCursor(DefaultResultSetHandler resultSetHandler, ResultMap resultMap, ResultSetWrapper rsw, RowBounds rowBounds)
-
-
Method Detail
-
isOpen
public boolean isOpen()
-
isConsumed
public boolean isConsumed()
- Specified by:
isConsumed
in interfaceCursor<T>
- Returns:
- true if the cursor is fully consumed and has returned all elements matching the query.
-
getCurrentIndex
public int getCurrentIndex()
Description copied from interface:Cursor
Get the current item index. The first item has the index 0.- Specified by:
getCurrentIndex
in interfaceCursor<T>
- Returns:
- -1 if the first cursor item has not been retrieved. The index of the current item retrieved.
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
fetchNextUsingRowBound
protected T fetchNextUsingRowBound()
-
fetchNextObjectFromDatabase
protected T fetchNextObjectFromDatabase()
-
-