Package org.apache.calcite.avatica.util

## Class ArrayImpl

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

All Implemented Interfaces:
  `java.sql.Array`

    public class ArrayImpl
    extends java.lang.Object
    implements java.sql.Array

Implementation of JDBC `Array`.

### Nested Class Summary

Nested Classes
`static interface` `ArrayImpl.Factory` Factory that can create a ResultSet or Array based on a stream of values.

### Field Summary

Fields
`private AbstractCursor.ArrayAccessor` `accessor`
`private java.util.List<java.lang.Object>` `list`

### Constructor Summary

Constructors
`ArrayImpl​(java.util.List<java.lang.Object> list, AbstractCursor.ArrayAccessor accessor)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`private void` `append​(java.lang.StringBuilder buf, java.lang.Object o)`
`static boolean` `equalContents​(java.sql.Array left, java.sql.Array right)` Returns whether two arrays have the same contents.
`void` `free()`
`java.lang.Object` `getArray()`
`java.lang.Object` `getArray​(long index, int count)`
`java.lang.Object` `getArray​(long index, int count, java.util.Map<java.lang.String,​java.lang.Class<?>> map)`
`protected java.lang.Object` `getArray​(java.util.List<?> list, AbstractCursor.ArrayAccessor arrayAccessor)` Converts a list into an array.
`java.lang.Object` `getArray​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)`
`(package private) java.lang.Object` `getArrayData​(java.lang.Object o, AbstractCursor.ArrayAccessor componentAccessor)`
`int` `getBaseType()`
`java.lang.String` `getBaseTypeName()`
`java.sql.ResultSet` `getResultSet()`
`java.sql.ResultSet` `getResultSet​(long index, int count)`
`java.sql.ResultSet` `getResultSet​(long index, int count, java.util.Map<java.lang.String,​java.lang.Class<?>> map)`
`java.sql.ResultSet` `getResultSet​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)`
`java.lang.String` `toString()`

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

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

### Field Detail

#### list

    private final java.util.List<java.lang.Object> list

#### accessor

    private final AbstractCursor.ArrayAccessor accessor

### Constructor Detail

#### ArrayImpl

    public ArrayImpl​(java.util.List<java.lang.Object> list,
                     AbstractCursor.ArrayAccessor accessor)

### Method Detail

#### getBaseTypeName

    public java.lang.String getBaseTypeName()
                                     throws java.sql.SQLException

Specified by:
  `getBaseTypeName` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### getBaseType

    public int getBaseType()
                    throws java.sql.SQLException

Specified by:
  `getBaseType` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### getArray

    public java.lang.Object getArray()
                              throws java.sql.SQLException

Specified by:
  `getArray` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### append

    private void append​(java.lang.StringBuilder buf,
                        java.lang.Object o)

#### getArray

    protected java.lang.Object getArray​(java.util.List<?> list,
                                        AbstractCursor.ArrayAccessor arrayAccessor)
                                 throws java.sql.SQLException

Converts a list into an array.

If the elements of the list are primitives, converts to an array of primitives (e.g. `boolean[]`.

Parameters:
  `list` - List of objects
Returns:
  array
Throws:
  `java.lang.ClassCastException` - if any element is not of the box type
  `java.lang.NullPointerException` - if any element is null
  `java.sql.SQLException`

#### getArrayData

    java.lang.Object getArrayData​(java.lang.Object o,
                                  AbstractCursor.ArrayAccessor componentAccessor)
                           throws java.sql.SQLException

Throws:
  `java.sql.SQLException`

#### getArray

    public java.lang.Object getArray​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
                              throws java.sql.SQLException

Specified by:
  `getArray` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### getArray

    public java.lang.Object getArray​(long index,
                                     int count)
                              throws java.sql.SQLException

Specified by:
  `getArray` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### getArray

    public java.lang.Object getArray​(long index,
                                     int count,
                                     java.util.Map<java.lang.String,​java.lang.Class<?>> map)
                              throws java.sql.SQLException

Specified by:
  `getArray` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### getResultSet

    public java.sql.ResultSet getResultSet()
                                    throws java.sql.SQLException

Specified by:
  `getResultSet` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### getResultSet

    public java.sql.ResultSet getResultSet​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
                                    throws java.sql.SQLException

Specified by:
  `getResultSet` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### getResultSet

    public java.sql.ResultSet getResultSet​(long index,
                                           int count)
                                    throws java.sql.SQLException

Specified by:
  `getResultSet` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### getResultSet

    public java.sql.ResultSet getResultSet​(long index,
                                           int count,
                                           java.util.Map<java.lang.String,​java.lang.Class<?>> map)
                                    throws java.sql.SQLException

Specified by:
  `getResultSet` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### free

    public void free()
              throws java.sql.SQLException

Specified by:
  `free` in interface `java.sql.Array`
Throws:
  `java.sql.SQLException`

#### equalContents

    public static boolean equalContents​(java.sql.Array left,
                                        java.sql.Array right)
                                 throws java.sql.SQLException

Returns whether two arrays have the same contents.

Arrays must have the same size, and elements in the same order. Elements are compared using `Object.equals(Object)`, and null values are equal to each other.

Throws:
  `java.sql.SQLException`