提交 eb5236c0 编写于 作者: G guolindev

Marked async db operations as deprecated. Developers should handle async...

Marked async db operations as deprecated. Developers should handle async operations in their own way.
上级 7cfe9917
......@@ -18,25 +18,9 @@ package org.litepal
import android.content.ContentValues
import android.content.Context
import android.database.Cursor
import android.database.sqlite.SQLiteDatabase
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import org.litepal.crud.*
import org.litepal.crud.async.*
import org.litepal.exceptions.LitePalSupportException
import org.litepal.parser.LitePalAttr
import org.litepal.parser.LitePalParser
import org.litepal.tablemanager.Connector
import org.litepal.crud.LitePalSupport
import org.litepal.tablemanager.callback.DatabaseListener
import org.litepal.util.BaseUtility
import org.litepal.util.Const
import org.litepal.util.DBUtility
import org.litepal.util.SharedUtil
import org.litepal.util.cipher.CipherUtil
import java.io.File
import kotlin.math.tan
/**
* LitePal is an Android library that allows developers to use SQLite database extremely easy.
......@@ -208,6 +192,7 @@ object LitePal {
* @return A CountExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun countAsync(modelClass: Class<*>) = Operator.countAsync(modelClass)
/**
......@@ -236,6 +221,7 @@ object LitePal {
* @return A CountExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun countAsync(tableName: String) = Operator.countAsync(tableName)
/**
......@@ -266,6 +252,7 @@ object LitePal {
* @return A AverageExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun averageAsync(modelClass: Class<*>, column: String) = Operator.averageAsync(modelClass, column)
/**
......@@ -296,6 +283,7 @@ object LitePal {
* @return A AverageExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun averageAsync(tableName: String, column: String) = Operator.averageAsync(tableName, column)
/**
......@@ -331,6 +319,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> maxAsync(modelClass: Class<*>, columnName: String, columnType: Class<T>) = Operator.maxAsync(modelClass, columnName, columnType)
/**
......@@ -366,6 +355,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> maxAsync(tableName: String, columnName: String, columnType: Class<T>) = Operator.maxAsync(tableName, columnName, columnType)
/**
......@@ -401,6 +391,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> minAsync(modelClass: Class<*>, columnName: String, columnType: Class<T>) = Operator.minAsync(modelClass, columnName, columnType)
/**
......@@ -436,6 +427,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> minAsync(tableName: String, columnName: String, columnType: Class<T>) = Operator.minAsync(tableName, columnName, columnType)
/**
......@@ -471,6 +463,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> sumAsync(modelClass: Class<*>, columnName: String, columnType: Class<T>) = Operator.sumAsync(modelClass, columnName, columnType)
/**
......@@ -506,6 +499,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> sumAsync(tableName: String, columnName: String, columnType: Class<T>) = Operator.sumAsync(tableName, columnName, columnType)
/**
......@@ -539,6 +533,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> findAsync(modelClass: Class<T>, id: Long) = Operator.findAsync(modelClass, id)
/**
......@@ -571,6 +566,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> findAsync(modelClass: Class<T>, id: Long, isEager: Boolean) = Operator.findAsync(modelClass, id, isEager)
/**
......@@ -597,6 +593,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> findFirstAsync(modelClass: Class<T>) = Operator.findFirstAsync(modelClass)
/**
......@@ -625,6 +622,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> findFirstAsync(modelClass: Class<T>, isEager: Boolean) = Operator.findFirstAsync(modelClass, isEager)
/**
......@@ -651,6 +649,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> findLastAsync(modelClass: Class<T>) = Operator.findLastAsync(modelClass)
/**
......@@ -679,6 +678,7 @@ object LitePal {
* @return A FindExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> findLastAsync(modelClass: Class<T>, isEager: Boolean) = Operator.findLastAsync(modelClass, isEager)
/**
......@@ -720,6 +720,7 @@ object LitePal {
* @return A FindMultiExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> findAllAsync(modelClass: Class<T>, vararg ids: Long) = Operator.findAllAsync(modelClass, *ids)
/**
......@@ -752,6 +753,7 @@ object LitePal {
* @return A FindMultiExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T> findAllAsync(modelClass: Class<T>, isEager: Boolean, vararg ids: Long) = Operator.findAllAsync(modelClass, isEager, *ids)
/**
......@@ -800,6 +802,7 @@ object LitePal {
* @return A UpdateOrDeleteExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun deleteAsync(modelClass: Class<*>, id: Long) = Operator.deleteAsync(modelClass, id)
/**
......@@ -843,6 +846,7 @@ object LitePal {
* @return A UpdateOrDeleteExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun deleteAllAsync(modelClass: Class<*>, vararg conditions: String?) = Operator.deleteAllAsync(modelClass, *conditions)
/**
......@@ -889,6 +893,7 @@ object LitePal {
* @return A UpdateOrDeleteExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun deleteAllAsync(tableName: String, vararg conditions: String?) = Operator.deleteAllAsync(tableName, *conditions)
/**
......@@ -928,6 +933,7 @@ object LitePal {
* @return A UpdateOrDeleteExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun updateAsync(modelClass: Class<*>, values: ContentValues, id: Long) = Operator.updateAsync(modelClass, values, id)
/**
......@@ -981,6 +987,7 @@ object LitePal {
* @return A UpdateOrDeleteExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun updateAllAsync(modelClass: Class<*>, values: ContentValues, vararg conditions: String?) = Operator.updateAllAsync(modelClass, values, *conditions)
/**
......@@ -1034,6 +1041,7 @@ object LitePal {
* @return A UpdateOrDeleteExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun updateAllAsync(tableName: String, values: ContentValues, vararg conditions: String?) = Operator.updateAllAsync(tableName, values, *conditions)
/**
......@@ -1070,6 +1078,7 @@ object LitePal {
* @return A SaveExecutor instance.
*/
@JvmStatic
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
fun <T : LitePalSupport> saveAllAsync(collection: Collection<T>) = Operator.saveAllAsync(collection)
/**
......
......@@ -50,6 +50,7 @@ inline fun <reified T> FluentQuery.find(): List<T> = find(T::class.java)
*
* @return A FindMultiExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> FluentQuery.findAsync() = findAsync(T::class.java)
/**
......@@ -72,6 +73,7 @@ inline fun <reified T> FluentQuery.find(isEager: Boolean): List<T> = find(T::cla
* True to load the associated models, false not.
* @return A FindMultiExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> FluentQuery.findAsync(isEager: Boolean) = findAsync(T::class.java, isEager)
/**
......@@ -93,6 +95,7 @@ inline fun <reified T> FluentQuery.findFirst(): T? = findFirst(T::class.java)
*
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> FluentQuery.findFirstAsync(): FindExecutor<T> = findFirstAsync(T::class.java)
/**
......
......@@ -45,6 +45,7 @@ inline fun <reified T> LitePal.count() = count(T::class.java)
*
* @return A CountExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.countAsync() = countAsync(T::class.java)
/**
......@@ -69,6 +70,7 @@ inline fun <reified T> LitePal.average(column: String) = average(T::class.java,
* The based on column to calculate.
* @return A AverageExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.averageAsync(column: String) = averageAsync(T::class.java, column)
/**
......@@ -95,6 +97,7 @@ inline fun <reified T, reified R> LitePal.max(columnName: String) = max(T::class
* The based on column to calculate.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T, reified R> LitePal.maxAsync(columnName: String) = maxAsync(T::class.java, columnName, R::class.java)
/**
......@@ -124,6 +127,7 @@ inline fun <reified R> LitePal.max(tableName: String, columnName: String) = max(
* The based on column to calculate.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified R> LitePal.maxAsync(tableName: String, columnName: String) = maxAsync(tableName, columnName, R::class.java)
/**
......@@ -149,6 +153,7 @@ inline fun <reified T, reified R> LitePal.min(columnName: String) = min(T::class
* The based on column to calculate.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T, reified R> LitePal.minAsync(columnName: String) = minAsync(T::class.java, columnName, R::class.java)
/**
......@@ -178,6 +183,7 @@ inline fun <reified R> LitePal.min(tableName: String, columnName: String) = min(
* The based on column to calculate.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified R> LitePal.minAsync(tableName: String, columnName: String) = minAsync(tableName, columnName, R::class.java)
/**
......@@ -203,6 +209,7 @@ inline fun <reified T, reified R> LitePal.sum(columnName: String) = sum(T::class
* The based on column to calculate.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T, reified R> LitePal.sumAsync(columnName: String) = sumAsync(T::class.java, columnName, R::class.java)
/**
......@@ -232,6 +239,7 @@ inline fun <reified R> LitePal.sum(tableName: String, columnName: String) = sum(
* The based on column to calculate.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified R> LitePal.sumAsync(tableName: String, columnName: String) = sumAsync(tableName, columnName, R::class.java)
/**
......@@ -255,6 +263,7 @@ inline fun <reified T> LitePal.find(id: Long): T? = find(T::class.java, id)
* Which record to query.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.findAsync(id: Long) = findAsync(T::class.java, id)
/**
......@@ -281,6 +290,7 @@ inline fun <reified T> LitePal.find(id: Long, isEager: Boolean) = find(T::class.
* True to load the associated models, false not.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.findAsync(id: Long, isEager: Boolean) = find(T::class.java, id, isEager)
/**
......@@ -301,6 +311,7 @@ inline fun <reified T> LitePal.findFirst() = findFirst(T::class.java)
*
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.findFirstAsync() = findFirstAsync(T::class.java)
/**
......@@ -323,6 +334,7 @@ inline fun <reified T> LitePal.findFirst(isEager: Boolean) = findFirst(T::class.
* True to load the associated models, false not.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.findFirstAsync(isEager: Boolean) = findFirstAsync(T::class.java, isEager)
/**
......@@ -343,6 +355,7 @@ inline fun <reified T> LitePal.findLast() = findLast(T::class.java)
*
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.findLastAsync() = findLastAsync(T::class.java)
/**
......@@ -365,6 +378,7 @@ inline fun <reified T> LitePal.findLast(isEager: Boolean) = findLast(T::class.ja
* True to load the associated models, false not.
* @return A FindExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.findLastAsync(isEager: Boolean) = findLastAsync(T::class.java, isEager)
/**
......@@ -398,6 +412,7 @@ inline fun <reified T> LitePal.findAll(vararg ids: Long) = findAll(T::class.java
* Which records to query. Or do not pass it to find all records.
* @return A FindMultiExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.findAllAsync(vararg ids: Long) = findAllAsync(T::class.java, *ids)
/**
......@@ -424,6 +439,7 @@ inline fun <reified T> LitePal.findAll(isEager: Boolean, vararg ids: Long) = fin
* Which records to query. Or do not pass it to find all records.
* @return A FindMultiExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.findAllAsync(isEager: Boolean, vararg ids: Long) = findAllAsync(T::class.java, isEager, *ids)
/**
......@@ -449,6 +465,7 @@ inline fun <reified T> LitePal.delete(id: Long) = delete(T::class.java, id)
* Which record to delete.
* @return A UpdateOrDeleteExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.deleteAsync(id: Long) = deleteAsync(T::class.java, id)
/**
......@@ -486,6 +503,7 @@ inline fun <reified T> LitePal.deleteAll(vararg conditions: String?) = deleteAll
* all rows.
* @return A UpdateOrDeleteExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.deleteAllAsync(vararg conditions: String?) = deleteAllAsync(T::class.java, *conditions)
/**
......@@ -519,6 +537,7 @@ inline fun <reified T> LitePal.update(values: ContentValues, id: Long) = update(
* Which record to update.
* @return A UpdateOrDeleteExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.updateAsync(values: ContentValues, id: Long) = updateAsync(T::class.java, values, id)
/**
......@@ -566,6 +585,7 @@ inline fun <reified T> LitePal.updateAll(values: ContentValues, vararg condition
* all rows.
* @return A UpdateOrDeleteExecutor instance.
*/
@Deprecated("This method is deprecated and will be removed in the future releases.", ReplaceWith("Handle async db operation in your own logic instead."))
inline fun <reified T> LitePal.updateAllAsync(values: ContentValues, vararg conditions: String?) = updateAllAsync(T::class.java, values, *conditions)
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册