org.apache.calcite.avatica.util

## Class AbstractCursor

- java.lang.Object
- - org.apache.calcite.avatica.util.AbstractCursor

All Implemented Interfaces:
  AutoCloseable, Cursor

Direct Known Subclasses:
  PositionedCursor

    public abstract class AbstractCursor
    extends Object
    implements Cursor

Base class for implementing a cursor.

Derived class needs to provide `AbstractCursor.Getter` and can override `Cursor.Accessor` implementations if it wishes.

### Nested Class Summary

Nested Classes
`protected class` `AbstractCursor.AbstractGetter` Abstract implementation of `AbstractCursor.Getter`.
`static class` `AbstractCursor.ArrayAccessor` Accessor that assumes that the underlying value is an ARRAY; corresponds to `Types.ARRAY`.
`protected static interface` `AbstractCursor.Getter` Gets a value from a particular field of the current record of this cursor.
`class` `AbstractCursor.SlotGetter` Implementation of `AbstractCursor.Getter` that returns the current contents of a mutable slot.
`class` `AbstractCursor.StructGetter` Implementation of `AbstractCursor.Getter` that returns the value of a given field of the current contents of another getter.

### Nested classes/interfaces inherited from interface org.apache.calcite.avatica.util.Cursor

`Cursor.Accessor`

### Field Summary

Fields
`protected boolean[]` `wasNull` Slot into which each accessor should write whether the value returned was null.

### Constructor Summary

Constructors
`protected` `AbstractCursor()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected Cursor.Accessor` `createAccessor(ColumnMetaData columnMetaData, AbstractCursor.Getter getter, Calendar localCalendar, ArrayImpl.Factory factory)`
`protected Cursor.Accessor` `createAccessor(ColumnMetaData columnMetaData, int ordinal, Calendar localCalendar, ArrayImpl.Factory factory)`
`List<Cursor.Accessor>` `createAccessors(List<ColumnMetaData> types, Calendar localCalendar, ArrayImpl.Factory factory)` Creates a list of accessors, one per column.
`protected abstract AbstractCursor.Getter` `createGetter(int ordinal)`
`abstract boolean` `next()` Moves to the next row.
`boolean` `wasNull()` Returns whether the last value returned was null.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.calcite.avatica.util.Cursor

`close`

### Field Detail

#### wasNull

    protected final boolean[] wasNull

Slot into which each accessor should write whether the value returned was null.

### Constructor Detail

#### AbstractCursor

    protected AbstractCursor()

### Method Detail

#### wasNull

    public boolean wasNull()

Description copied from interface: `Cursor`
Returns whether the last value returned was null.

Specified by:
  `wasNull` in interface `Cursor`

#### createAccessors

    public List<Cursor.Accessor> createAccessors(List<ColumnMetaData> types,
                                                 Calendar localCalendar,
                                                 ArrayImpl.Factory factory)

Description copied from interface: `Cursor`
Creates a list of accessors, one per column.

Specified by:
  `createAccessors` in interface `Cursor`
Parameters:
  `types` - List of column types, per `Types`.
  `localCalendar` - Calendar in local time zone
  `factory` - Factory that creates sub-ResultSets when needed
Returns:
  List of column accessors

#### createAccessor

    protected Cursor.Accessor createAccessor(ColumnMetaData columnMetaData,
                                             int ordinal,
                                             Calendar localCalendar,
                                             ArrayImpl.Factory factory)

#### createAccessor

    protected Cursor.Accessor createAccessor(ColumnMetaData columnMetaData,
                                             AbstractCursor.Getter getter,
                                             Calendar localCalendar,
                                             ArrayImpl.Factory factory)

#### createGetter

    protected abstract AbstractCursor.Getter createGetter(int ordinal)

#### next

    public abstract boolean next()

Description copied from interface: `Cursor`
Moves to the next row.

Specified by:
  `next` in interface `Cursor`
Returns:
  Whether moved