语言

SetSchemaRequest.Builder.SetMigrator(String, Migrator) 方法

定义

设置与给定 SchemaType 关联的迁移程序。

[Android.Runtime.Register("setMigrator", "(Ljava/lang/String;Landroid/app/appsearch/Migrator;)Landroid/app/appsearch/SetSchemaRequest$Builder;", "", ApiSince=31)]
public Android.App.AppSearch.SetSchemaRequest.Builder SetMigrator(string schemaType, Android.App.AppSearch.Migrator migrator);
[<Android.Runtime.Register("setMigrator", "(Ljava/lang/String;Landroid/app/appsearch/Migrator;)Landroid/app/appsearch/SetSchemaRequest$Builder;", "", ApiSince=31)>]
member this.SetMigrator : string * Android.App.AppSearch.Migrator -> Android.App.AppSearch.SetSchemaRequest.Builder

参数

schemaType
String

要设置迁移器的架构类型。 此值不能为 null。

migrator
Migrator

迁移程序通过 setVersion(int)将文档从当前版本转换为最终版本集。 此值不能为 null。

返回

此生成器实例。

特性

注解

设置与给定 SchemaType 关联的迁移程序。 迁移程序将给定架构类型下的所有 GenericDocument 对象从 AppSearch 中存储的当前版本号迁移到通过 setVersion(int) 设置的最终版本集。 如果 AppSearch 中存储的当前版本号不同于通过 setVersion(int) 设置的最终版本集,并且 Migrator.shouldMigrate 返回 true,将调用迁移程序。 Output GenericDocument of Migrator.onUpgrade 或 Migrator.onDowngrade 的目标架构类型必须存在于此 SetSchemaRequest 中。

Android 参考。android.app.appsearch.SetSchemaRequest.Builder.setMigrator

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于