Class AbstractCursor<E>
java.lang.Object
org.apache.directory.api.ldap.model.cursor.AbstractCursor<E>
- Type Parameters:
E- The type of element on which this cursor will iterate
- All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<E>, Cursor<E>
- Direct Known Subclasses:
EmptyCursor, ListCursor, SetCursor, SingletonCursor
Simple class that contains often used Cursor code.
- Author:
- Apache Directory Project
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidCheck that the cursor is not closed before executing an operation.voidclose()voidCloses this Cursor and frees any resources it my have allocated.booleanIs this Cursor positioned after the last element.booleanIs this Cursor positioned before the first element.booleanisClosed()Checks if this Cursor is closed.booleanisFirst()Is this Cursor positioned at the first element.booleanisLast()Is this Cursor positioned at the last element.iterator()voidsetClosureMonitor(ClosureMonitor monitor) Sets a non-null closure monitor to associate with this Cursor.Pretty-print a cursor and its wrapped cursor.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Cursor
after, afterLast, available, before, beforeFirst, first, get, last, next, previousMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
AbstractCursor
protected AbstractCursor()A default constructor
-
-
Method Details
-
setClosureMonitor
Sets a non-null closure monitor to associate with this Cursor.- Specified by:
setClosureMonitorin interfaceCursor<E>- Parameters:
monitor- the monitor to use for detecting Cursor close events
-
checkNotClosed
Check that the cursor is not closed before executing an operation.- Throws:
CursorClosedException- If there is a problem during the check
-
isClosed
-
close
Closes this Cursor and frees any resources it my have allocated. Repeated calls to this method after this Cursor has already been called should not fail with exceptions. The reason argument is the Exception instance thrown instead of the standard CursorClosedException.- Specified by:
closein interfaceCursor<E>- Parameters:
cause- exception thrown when this Cursor is accessed after close- Throws:
IOException- If we can't close the Cursor
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
iterator
-
isAfterLast
public boolean isAfterLast()Is this Cursor positioned after the last element.- Specified by:
isAfterLastin interfaceCursor<E>- Returns:
- true if this cursor is positioned after the last element, false otherwise
-
isBeforeFirst
public boolean isBeforeFirst()Is this Cursor positioned before the first element.- Specified by:
isBeforeFirstin interfaceCursor<E>- Returns:
- true if this cursor is positioned before the first element, false otherwise
-
isFirst
-
isLast
-
toString
-