Comparator<OrmMigration>public class UpgradeComparator extends Object implements Comparator<OrmMigration>
The comparator sorts OrmMigration objects in an ascending order of the version number
so that the database can be upgraded in the given order. The comparator automatically takes effect
during a database upgrade.
DowngradeComparatorSystemCapability.Data#DATA_APPDATAMGR| 构造器 | 说明 |
|---|---|
UpgradeComparator() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
compare(OrmMigration o1,
OrmMigration o2) |
Compares the upgrade sequence of two
OrmMigration objects. |
public int compare(OrmMigration o1, OrmMigration o2)
OrmMigration objects.
The OrmMigration object with an earlier start version will be upgraded before the other. If the two
OrmMigration objects have the same start version, the object with an earlier end version will be upgraded
before the other.
compare 在接口中 Comparator<OrmMigration>o1 - Indicates the first OrmMigration object.o2 - Indicates the second OrmMigration object.-1 if the first object will be upgraded before the second object; returns 0
if the two objects will be upgraded at the same time; returns 1 if the second object will be upgraded
before the first object.