org.apache.calcite.avatica.util

## Class ArrayFactoryImpl

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

All Implemented Interfaces:
  ArrayImpl.Factory

Direct Known Subclasses:
  AvaticaResultSet

    public class ArrayFactoryImpl
    extends Object
    implements ArrayImpl.Factory

Implementation of `ArrayImpl.Factory`.

### Field Summary

Fields
`private TimeZone` `timeZone`

### Constructor Summary

Constructors
Constructor and Description
`ArrayFactoryImpl(TimeZone timeZone)`

### Method Summary

All Methods Instance Methods Concrete Methods
`ResultSet` `create(ColumnMetaData.AvaticaType elementType, Iterable<Object> elements)` Creates a `ResultSet` from the given list of values per `Array.getResultSet()`.
`Array` `createArray(ColumnMetaData.AvaticaType elementType, Iterable<Object> elements)` Creates an `Array` from the given list of values, converting any primitive values into the corresponding objects.
`private List<List<Object>>` `createResultSetRowsForArrayData(Iterable<Object> elements)` Creates the row-level view over the values that will make up an Array.
`private Iterator<List<Object>>` `createRowForArrayData(List<Object> elements)` Creates an row-level view over the values that will make up an Array.

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

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

### Field Detail

#### timeZone

    private TimeZone timeZone

### Constructor Detail

#### ArrayFactoryImpl

    public ArrayFactoryImpl(TimeZone timeZone)

### Method Detail

#### create

    public ResultSet create(ColumnMetaData.AvaticaType elementType,
                            Iterable<Object> elements)
                     throws SQLException

Description copied from interface: `ArrayImpl.Factory`
Creates a `ResultSet` from the given list of values per `Array.getResultSet()`.

Specified by:
  `create` in interface `ArrayImpl.Factory`
Parameters:
  `elementType` - The type of the elements
  `elements` - The elements
Throws:
  `SQLException`

#### createArray

    public Array createArray(ColumnMetaData.AvaticaType elementType,
                             Iterable<Object> elements)

Description copied from interface: `ArrayImpl.Factory`
Creates an `Array` from the given list of values, converting any primitive values into the corresponding objects.

Specified by:
  `createArray` in interface `ArrayImpl.Factory`
Parameters:
  `elementType` - The type of the elements
  `elements` - The elements

#### createResultSetRowsForArrayData

    private List<List<Object>> createResultSetRowsForArrayData(Iterable<Object> elements)

Creates the row-level view over the values that will make up an Array. The Iterator has a row per Array element, each row containing two columns. The second column is the array element and the first column is the offset into the array of that array element (one-based, not zero-based).

The ordering of the rows is not guaranteed to be in the same order as the array elements.

A list of `elements`:

    [1, 2, 3]

might be converted into

    Iterator{ [1, 1], [2, 2], [3, 3] }

Parameters:
  `elements` - The elements of an array.

#### createRowForArrayData

    private Iterator<List<Object>> createRowForArrayData(List<Object> elements)

Creates an row-level view over the values that will make up an Array. The Iterator has one entry which has a list that also has one entry.

A provided list of `elements`

    [1, 2, 3]

would be converted into

    Iterator{ [ [1,2,3] ] }

Parameters:
  `elements` - The elements of an array