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,EntryCursorImpl,ListCursor,SearchCursorImpl,SetCursor,SingletonCursor
public abstract class AbstractCursor<E> extends Object implements Cursor<E>
Simple class that contains often used Cursor code.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description AbstractCursor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckNotClosed()Check that the cursor is not closed before executing an operation.voidclose()voidclose(Exception cause)Closes this Cursor and frees any resources it my have allocated.booleanisAfterLast()Is this Cursor positioned after the last element.booleanisBeforeFirst()Is 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<E>iterator()voidsetClosureMonitor(ClosureMonitor monitor)Sets a non-null closure monitor to associate with this Cursor.StringtoString(String tabs)Pretty-print a cursor and its wrapped cursor.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.directory.api.ldap.model.cursor.Cursor
after, afterLast, available, before, beforeFirst, first, get, last, next, previous
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
setClosureMonitor
public void setClosureMonitor(ClosureMonitor monitor)
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
public final void checkNotClosed() throws CursorClosedExceptionCheck that the cursor is not closed before executing an operation.- Throws:
CursorClosedException- If there is a problem during the check
-
isClosed
public boolean isClosed()
Checks if this Cursor is closed. Calls to this operation should not fail with exceptions if and only if the cursor is in the closed state.
-
close
public void close(Exception cause) throws IOException
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
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
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
public boolean isFirst()
Is this Cursor positioned at the first element.
-
isLast
public boolean isLast()
Is this Cursor positioned at the last element.
-
-