shillelagh-processor/src/main/java/shillelagh/internal/TableObject.java
private void emitMapCursorToObject(JavaWriter javaWriter) throws IOException {
    logger.d("emitMapCursorToObject");

    final String targetClass = getTargetClass();

    javaWriter.beginMethod("List<" + targetClass + ">", $$MAP_OBJECT_FUNCTION,
        EnumSet.of(PUBLIC, STATIC), "Cursor", "cursor", "SQLiteDatabase", "db")
        .emitStatement("List<%s> tableObjects = new LinkedList<%s>()", targetClass, targetClass)
        .beginControlFlow("if (cursor.moveToFirst())")
        .beginControlFlow("while (!cursor.isAfterLast())")
        .emitStatement("%s tableObject = %s(cursor, db)", targetClass, $$MAP_SINGLE_FUNCTION)
        .emitStatement("tableObjects.add(tableObject)")
        .emitStatement("cursor.moveToNext()")
        .endControlFlow()
        .endControlFlow()
        .emitStatement("return tableObjects")
        .endMethod();
  }
private void emitMapCursorToObject(JavaWriter javaWriter) throws IOException {
    logger.d("emitMapCursorToObject");

    final String targetClass = getTargetClass();

    javaWriter.beginMethod("List<" + targetClass + ">", $$MAP_OBJECT_FUNCTION,
        EnumSet.of(PUBLIC, STATIC), "Cursor", "cursor", "SQLiteDatabase", "db")
        .emitStatement("List<%s> tableObjects = new LinkedList<%s>()", targetClass, targetClass)
        .beginControlFlow("if (cursor.moveToFirst())")
        .beginControlFlow("while (!cursor.isAfterLast())")
        .emitStatement("%s tableObject = %s(cursor, db)", targetClass, $$MAP_SINGLE_FUNCTION)
        .emitStatement("tableObjects.add(tableObject)")
        .emitStatement("cursor.moveToNext()")
        .endControlFlow()
        .endControlFlow()
        .emitStatement("return tableObjects")
        .endMethod();
  }
private void emitMapCursorToObject ( JavaWriter javaWriter ) throws IOException { logger . d ( "emitMapCursorToObject" ) ; final String targetClass = getTargetClass ( ) ; javaWriter . beginMethod ( "List<" + targetClass + ">" , $$ MAP_OBJECT_FUNCTION , EnumSet . of ( PUBLIC , STATIC ) , "Cursor" , "cursor" , "SQLiteDatabase" , "db" ) . emitStatement ( "List<%s> tableObjects = new LinkedList<%s>()" , targetClass , targetClass ) . beginControlFlow ( "if (cursor.moveToFirst())" ) . beginControlFlow ( "while (!cursor.isAfterLast())" ) . emitStatement ( "%s tableObject = %s(cursor, db)" , targetClass , $$ MAP_SINGLE_FUNCTION ) . emitStatement ( "tableObjects.add(tableObject)" ) . emitStatement ( "cursor.moveToNext()" ) . endControlFlow ( ) . endControlFlow ( ) . emitStatement ( "return tableObjects" ) . endMethod ( ) ; }
Creates the function for mapping a cursor to the object after executing a sql statement
Creates the function for mapping a cursor to the object after executing a sql statement