Comparator<OrmMigration>public class DowngradeComparator extends Object implements Comparator<OrmMigration>
The comparator sorts OrmMigration objects in a descending order of the version number
so that the database can be downgraded in the given order.
The comparator automatically takes effect during a database downgrade.
UpgradeComparatorSystemCapability.Data#DATA_APPDATAMGR| 构造器 | 说明 |
|---|---|
DowngradeComparator() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
compare(OrmMigration o1,
OrmMigration o2) |
Compares the downgrade sequence of two
OrmMigration objects. |
public int compare(OrmMigration o1, OrmMigration o2)
OrmMigration objects.
The OrmMigration object with a later start version will be downgraded before the other. If the two
OrmMigration objects have the same start version, the object with a later end version will be downgraded
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 downgraded before the second object; returns 0
if the two objects will be downgraded at the same time; returns 1 if the second object will be downgraded
before the first object.