Package org.apache.calcite.avatica.util
Class IteratorCursor<E>
- java.lang.Object
-
- org.apache.calcite.avatica.util.AbstractCursor
-
- org.apache.calcite.avatica.util.PositionedCursor<E>
-
- org.apache.calcite.avatica.util.IteratorCursor<E>
-
- Type Parameters:
E- Element type
- All Implemented Interfaces:
java.lang.AutoCloseable,Cursor
- Direct Known Subclasses:
ArrayIteratorCursor,ListIteratorCursor,MapIteratorCursor,RecordIteratorCursor
public abstract class IteratorCursor<E> extends PositionedCursor<E>
Implementation ofCursoron top of anIteratorthat returns a record for each row. The returned record is cached to avoid multiple computations of current row.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classIteratorCursor.PositionAre we positioned on a valid row?-
Nested classes/interfaces inherited from class org.apache.calcite.avatica.util.PositionedCursor
PositionedCursor.ArrayGetter, PositionedCursor.FieldGetter, PositionedCursor.ListGetter, PositionedCursor.MapGetter<K>, PositionedCursor.ObjectGetter
-
Nested classes/interfaces inherited from class org.apache.calcite.avatica.util.AbstractCursor
AbstractCursor.AbstractGetter, AbstractCursor.AccessorImpl, AbstractCursor.ArrayAccessor, AbstractCursor.Getter, AbstractCursor.NumberAccessor, AbstractCursor.SlotGetter, AbstractCursor.StructGetter
-
Nested classes/interfaces inherited from interface org.apache.calcite.avatica.util.Cursor
Cursor.Accessor
-
-
Field Summary
Fields Modifier and Type Field Description private Ecurrentprivate java.util.Iterator<E>iteratorprivate IteratorCursor.Positionposition-
Fields inherited from class org.apache.calcite.avatica.util.AbstractCursor
wasNull
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIteratorCursor(java.util.Iterator<E> iterator)Creates anIteratorCursor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this cursor and releases resources.protected Ecurrent()Returns the current row.booleannext()Moves to the next row.-
Methods inherited from class org.apache.calcite.avatica.util.AbstractCursor
createAccessor, createAccessor, createAccessors, createGetter, intToTime, longToTimestamp, wasNull
-
-
-
-
Field Detail
-
position
private IteratorCursor.Position position
-
iterator
private final java.util.Iterator<E> iterator
-
current
private E current
-
-
Constructor Detail
-
IteratorCursor
protected IteratorCursor(java.util.Iterator<E> iterator)
Creates anIteratorCursor.- Parameters:
iterator- input iterator
-
-
Method Detail
-
next
public boolean next()
Description copied from interface:CursorMoves to the next row.- Specified by:
nextin interfaceCursor- Specified by:
nextin classAbstractCursor- Returns:
- Whether moved
-
close
public void close()
Description copied from interface:CursorCloses this cursor and releases resources.
-
current
protected E current()
Description copied from class:PositionedCursorReturns the current row.- Specified by:
currentin classPositionedCursor<E>- Returns:
- current row
-
-