实体数据的状态
可转换为数字
public static int toInt(EntityState state) {
if (state == NONE) {
return 0;
}
if (state == NEW) {
return 1;
}
if (state == MODIFIED) {
return 2;
}
if (state == DELETED) {
return 3;
}
if (state == MOVED) {
return 4;
}
return 0;
}
public static EntityState fromInt(int i) {
switch (i) {
case 0:
return NONE;
case 1:
return NEW;
case 2:
return MODIFIED;
case 3:
return DELETED;
case 4:
return MOVED;
default:
return NONE;
}
}