鴻蒙OS DataAbilityUtils

2022-09-02 17:39 更新

DataAbilityUtils

java.lang.Object

|---ohos.data.dataability.DataAbilityUtils

public class DataAbilityUtils
extends Object

為數(shù)據(jù)庫操作提供靜態(tài)方法的實用程序類。

此類提供了從 DataAbilityPredicates 對象創(chuàng)建 OrmPredicates 和 RdbPredicates 對象的接口。

方法總結(jié)

修飾符和類型 方法 描述
static <T extends OrmObject>OrmPredicates createOrmPredicates(DataAbilityPredicates dataAbilityPredicates, Class<T> klass) 從 DataAbilityPredicates 對象創(chuàng)建 OrmPredicates 對象。
static RdbPredicates createRdbPredicates(DataAbilityPredicates dataAbilityPredicates, String tableName) 從 DataAbilityPredicates 對象創(chuàng)建 RdbPredicates 對象。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

方法詳情

createRdbPredicates

public static RdbPredicates createRdbPredicates(DataAbilityPredicates dataAbilityPredicates, String tableName)

從 DataAbilityPredicates 對象創(chuàng)建 RdbPredicates 對象。

RdbPredicates 對象可用于執(zhí)行數(shù)據(jù)庫操作。

參數(shù):

參數(shù)名稱 參數(shù)描述
dataAbilityPredicates 指示用于創(chuàng)建 RdbPredicates 對象的 DataAbilityPredicates 對象。
tableName 表示表名。

返回:

返回 RdbPredicates 對象。

Throws:

Throw名稱 Throw描述
IllegalArgumentException 如果 tableName 為 null 或無法從 DataAbilityPredicates 對象創(chuàng)建 RdbPredicates 對象,則引發(fā)此異常。

createOrmPredicates

public static <T extends OrmObject> OrmPredicates createOrmPredicates(DataAbilityPredicates dataAbilityPredicates, Class<T> klass)

從 DataAbilityPredicates 對象創(chuàng)建 OrmPredicates 對象。

OrmPredicates 對象可用于執(zhí)行數(shù)據(jù)庫操作。

參數(shù):

參數(shù)名稱 參數(shù)描述
dataAbilityPredicates 指示用于創(chuàng)建 OrmPredicates 對象的 DataAbilityPredicates 對象。
klass 表示類。

返回:

返回 OrmPredicates 對象。

Throws:

Throw名稱 Throw描述
IllegalArgumentException 如果 klass 為 null 或無法從 DataAbilityPredicates 對象創(chuàng)建 OrmPredicates 對象,則引發(fā)此異常。
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號