app/src/main/java/db/juhaku/juhakudb/core/android/EntityConverter.java
/**
     * Convert cursor of SQL query result to list of entities. Root stands for root of SQL
     * query containing joins to other tables if defined.
     *
     * <p>Entities are converted distinctly for root entity.</p>
     *
     * @param cursor {@link Cursor} containing SQL query result.
     * @param root {@link Root} of SQL query.
     * @return List of converted entities from cursor's returned rows.
     *
     * @throws ConversionException if any exception occurs during conversion.
     *
     * @since 1.2.0
     */
Convert cursor of SQL query result to list of entities. Root stands for root of SQL
query containing joins to other tables if defined.

Entities are converted distinctly for root entity.

@param cursor  Cursor containing SQL query result.
@param root  Root of SQL query.
@return List of converted entities from cursor's returned rows.

@throws ConversionException if any exception occurs during conversion.


Convert cursor of SQL query result to list of entities . Root stands for root of SQL query containing joins to other tables if defined . Entities are converted distinctly for root entity . @param cursor Cursor containing SQL query result . @param root Root of SQL query . @return List of converted entities from cursor ' s returned rows . @throws ConversionException if any exception occurs during conversion .
public <T> List<T> convertCursorToEntityList(Cursor cursor, Root<?> root) throws ConversionException {
        List<T> entities = new ArrayList<>();
        while (cursor.moveToNext()) {
            T entity = convertCursorToEntity(cursor, root.getModel());
            T foundEntity = findEntityById(ReflectionUtils.getIdFieldValue(entity), entities);
            /*
             * If entity is not found add it to the list, otherwise do not add new one. Transform
             * distinctly for root entity.
             */
            if (foundEntity == null) {
                entities.add(entity);
            }
            alterEntityConvertJoins(cursor, root, foundEntity == null ? entity : foundEntity);
            index.set(0);
        }
        return entities;
    }
public < T > List < T > convertCursorToEntityList ( Cursor cursor , Root < ? > root ) throws ConversionException { List < T > entities = new ArrayList < > ( ) ; while ( cursor . moveToNext ( ) ) { T entity = convertCursorToEntity ( cursor , root . getModel ( ) ) ; T foundEntity = findEntityById ( ReflectionUtils . getIdFieldValue ( entity ) , entities ) ; /*
             * If entity is not found add it to the list, otherwise do not add new one. Transform
             * distinctly for root entity.
             */ if ( foundEntity == null ) { entities . add ( entity ) ; } alterEntityConvertJoins ( cursor , root , foundEntity == null ? entity : foundEntity ) ; index . set ( 0 ) ; } return entities ; }
Convert cursor of SQL query result to list of entities.
Convert cursor of SQL query result to list of entities .
// convert the main object first. // convert joins from this model class. // reset index.