后浪云鸿蒙OS教程:鸿蒙OS DataAbilityUtils

DataAbilityUtils

java.lang.Object

|—ohos.data.dataability.DataAbilityUtils

public class DataAbilityUtils
extends Object

为数据库操作提供静态方法的实用程序类。

此类提供了从 DataAbilityPredicates 对象创建 OrmPredicates 和 RdbPredicates 对象的接口。

方法总结

修饰符和类型方法描述
static <T extends OrmObject>OrmPredicatescreateOrmPredicates(DataAbilityPredicates dataAbilityPredicates, Class<T> klass)从 DataAbilityPredicates 对象创建 OrmPredicates 对象。
static RdbPredicatescreateRdbPredicates(DataAbilityPredicates dataAbilityPredicates, String tableName)从 DataAbilityPredicates 对象创建 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 对象创建 RdbPredicates 对象。

RdbPredicates 对象可用于执行数据库操作。

参数:

参数名称参数描述
dataAbilityPredicates指示用于创建 RdbPredicates 对象的 DataAbilityPredicates 对象。
tableName表示表名。

返回:

返回 RdbPredicates 对象。

Throws:

Throw名称Throw描述
IllegalArgumentException如果 tableName 为 null 或无法从 DataAbilityPredicates 对象创建 RdbPredicates 对象,则引发此异常。

createOrmPredicates

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

从 DataAbilityPredicates 对象创建 OrmPredicates 对象。

OrmPredicates 对象可用于执行数据库操作。

参数:

参数名称参数描述
dataAbilityPredicates指示用于创建 OrmPredicates 对象的 DataAbilityPredicates 对象。
klass表示类。

返回:

返回 OrmPredicates 对象。

Throws:

Throw名称Throw描述
IllegalArgumentException如果 klass 为 null 或无法从 DataAbilityPredicates 对象创建 OrmPredicates 对象,则引发此异常。

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/156313.html<

(0)
运维的头像运维
上一篇2025-03-15 20:44
下一篇 2025-03-15 20:45

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注