34 lines
810 B
Java
34 lines
810 B
Java
package org.warp.cowdb.lists;
|
|
|
|
import org.warp.cowdb.EnhancedObject;
|
|
import org.warp.cowdb.IDatabase;
|
|
import org.warp.jcwdb.ann.DBDataType;
|
|
import org.warp.jcwdb.ann.DBField;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class EnhancedObjectCowList<T extends EnhancedObject> extends CowList<T> {
|
|
|
|
@DBField(id = 1, type = DBDataType.OBJECT)
|
|
private Class<T> type;
|
|
|
|
public EnhancedObjectCowList() {
|
|
super();
|
|
}
|
|
|
|
public EnhancedObjectCowList(IDatabase database, Class<T> type) throws IOException {
|
|
super(database);
|
|
this.type = type;
|
|
}
|
|
|
|
@Override
|
|
protected T loadItem(long uid) throws IOException {
|
|
return database.getObjectsIO().loadEnhancedObject(uid, type);
|
|
}
|
|
|
|
@Override
|
|
protected void writeItemToDisk(long uid, T item) throws IOException {
|
|
database.getObjectsIO().setEnhancedObject(uid, item);
|
|
}
|
|
}
|