@Test public void testSave() throws Exception { SQLiteOperator<TestTable> operator = SQLiteOperator.from(getContext(), TestTable.class); final TestTable table = new TestTable(); table.testString = "123"; table.testList = Arrays.asList("1", "2", "3"); table.testBoolean = true; table.unique = 1; table.testSerializable = new TestSerializable("test"); assertEquals(0, table.id); operator.save(table).executeBlocking(); assertEquals(1, table.id); table.id = 0; table.unique = 2; operator.save(table).executeBlocking(); assertEquals(2, table.id); operator.save(table).executeBlocking(); assertEquals(2, table.id); }
public SaveOperation<T> save(final @NonNull T... objectsToInsert) { final SQLiteDAO generated = getGeneratedDAO(null); final SQLiteDAO<T>[] generatedObjects = new SQLiteDAO[objectsToInsert.length]; for (int i = 0; i < objectsToInsert.length; i++) { generatedObjects[i] = getGeneratedDAO(objectsToInsert[i]); } return new SaveOperation<>(mContext, generated, generatedObjects); }
SQLiteOperator { public SaveOperation<T> save(final @NonNull T... objectsToInsert) { final SQLiteDAO generated = getGeneratedDAO(null); final SQLiteDAO<T>[] generatedObjects = new SQLiteDAO[objectsToInsert.length]; for (int i = 0; i < objectsToInsert.length; i++) { generatedObjects[i] = getGeneratedDAO(objectsToInsert[i]); } return new SaveOperation<>(mContext, generated, generatedObjects); } }
SQLiteOperator { public SaveOperation<T> save(final @NonNull T... objectsToInsert) { final SQLiteDAO generated = getGeneratedDAO(null); final SQLiteDAO<T>[] generatedObjects = new SQLiteDAO[objectsToInsert.length]; for (int i = 0; i < objectsToInsert.length; i++) { generatedObjects[i] = getGeneratedDAO(objectsToInsert[i]); } return new SaveOperation<>(mContext, generated, generatedObjects); } private  SQLiteOperator(final @NonNull Context context, final @NonNull Class<T> cls); }
SQLiteOperator { public SaveOperation<T> save(final @NonNull T... objectsToInsert) { final SQLiteDAO generated = getGeneratedDAO(null); final SQLiteDAO<T>[] generatedObjects = new SQLiteDAO[objectsToInsert.length]; for (int i = 0; i < objectsToInsert.length; i++) { generatedObjects[i] = getGeneratedDAO(objectsToInsert[i]); } return new SaveOperation<>(mContext, generated, generatedObjects); } private  SQLiteOperator(final @NonNull Context context, final @NonNull Class<T> cls); static SQLiteOperator<T> from(final @NonNull Context context,
                                             final @NonNull Class<T> cls); static SQLiteDatabase getReadableDatabase(final @NonNull Context context,
                                                     final @NonNull Class<?> cls); static SQLiteDatabase getWritableDatabase(final @NonNull Context context,
                                                     final @NonNull Class<?> cls); static void deleteDatabase(final @NonNull Context context,
                                      final @NonNull Class<?> cls); GetSingleOperation<T> getSingle(final @Nullable Object id); GetSingleOperation<T> getSingle(); GetListOperation<T> getList(); SaveOperation<T> save(final @NonNull T... objectsToInsert); SaveOperation<T> save(final @NonNull Collection<T> objectsToInsert); DeleteOperation<T> delete(final @Nullable T... objectsToDelete); DeleteOperation<T> delete(final @NonNull Collection<T> objectsToDelete); }
SQLiteOperator { public SaveOperation<T> save(final @NonNull T... objectsToInsert) { final SQLiteDAO generated = getGeneratedDAO(null); final SQLiteDAO<T>[] generatedObjects = new SQLiteDAO[objectsToInsert.length]; for (int i = 0; i < objectsToInsert.length; i++) { generatedObjects[i] = getGeneratedDAO(objectsToInsert[i]); } return new SaveOperation<>(mContext, generated, generatedObjects); } private  SQLiteOperator(final @NonNull Context context, final @NonNull Class<T> cls); static SQLiteOperator<T> from(final @NonNull Context context,
                                             final @NonNull Class<T> cls); static SQLiteDatabase getReadableDatabase(final @NonNull Context context,
                                                     final @NonNull Class<?> cls); static SQLiteDatabase getWritableDatabase(final @NonNull Context context,
                                                     final @NonNull Class<?> cls); static void deleteDatabase(final @NonNull Context context,
                                      final @NonNull Class<?> cls); GetSingleOperation<T> getSingle(final @Nullable Object id); GetSingleOperation<T> getSingle(); GetListOperation<T> getList(); SaveOperation<T> save(final @NonNull T... objectsToInsert); SaveOperation<T> save(final @NonNull Collection<T> objectsToInsert); DeleteOperation<T> delete(final @Nullable T... objectsToDelete); DeleteOperation<T> delete(final @NonNull Collection<T> objectsToDelete);  }