/** * Converts a given array value into a {@link Array} * * @param value The non null value to be converted * @param binding The attribute binding (of array type * @param connection The connection used to create an {@link Array} * @return The converted array * @throws SQLException */ protected Array convertToArray( Object value, String componentTypeName, Class componentType, Connection connection) throws SQLException { int length = getLength(value); Object[] elements = new Object[length]; for (int i = 0; i < elements.length; i++) { Object element = java.lang.reflect.Array.get(value, i); if (element == null) { elements[i] = null; } else { Object converted = convertArrayElement(element, componentType); elements[i] = converted; } } return connection.createArrayOf(componentTypeName, elements); }